Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:44:01+00:00 2026-06-14T10:44:01+00:00

I am unable to append a string of text from a non activity class

  • 0

I am unable to append a string of text from a non activity class to an EditText view.

I have tried passing a view as a parameter to the constructor of the class.

The Basic problem is that I am unable to use findViewById in a non-Activity class.

I know this is a silly question, but I have tried a lot but simply not able to get that.

My code sample is :

    /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.printtesting;

import android.app.Activity;
import android.widget.EditText;
import java.math.BigInteger;
import java.util.Random;
import java.util.Vector;
//import javax.swing.JOptionPane;

/**
 *
 * @author HP
 */
public class keyGenerator {

    /**
     * @param args the command line arguments
     */

      static  Vector check = new Vector();


      static protected BigInteger p= new BigInteger("161");
      static protected BigInteger q= new BigInteger("47");
      static protected Random s = new Random();
      static protected BigInteger n = new BigInteger("1");
      static protected BigInteger trails;
      static protected BigInteger lambda ;
      static protected BigInteger nsq  = new BigInteger("1");
      static protected BigInteger g = new BigInteger("1");
      static protected BigInteger temp = new BigInteger("1");

    static protected int maxbit;
    private static BigInteger two = new BigInteger("2");

    public keyGenerator() {
      //  p = new BigInteger(7,1,s);
                System.out.println(p.toString());
      /*  while(!isPrime(p) && ( (p.compareTo(two)==1) || (p.compareTo(two))==0) )
        {
                p = new BigInteger(7,1,s);

        System.out.println(p.toString());
        }*/
        System.out.println("P is " + p);


    //    q = new BigInteger(7,1,s);
      /*  while(!isPrime(q) && ( (q.compareTo(two)==1) || (q.compareTo(two))==0) )
        {
                q = new BigInteger(7,1,s);
        }*/
        System.out.println("Q is " + q);




        // TODO code application logic here

       // BigInteger oth = new BigInteger("132312"); 
       generateKey();

    }


    protected  void generateKey()
    {
   EditText et = (EditText) Activity.findViewByID(R.string.te);
    // N=pq
    n=n.multiply(p);
    n=n.multiply(q);
    ....
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:44:03+00:00Added an answer on June 14, 2026 at 10:44 am

    You can pass Context of Edittext Activity Class to Non keyGenerator Class as :

    Context conn;
    public keyGenerator(Context con) {
    conn=con;
    //Your Code...
    }
    

    Now you can append text on keyGenerator to Edittext as:

    EditText et = (EditText)conn.findViewByID(R.string.te);
    et.append("your text here");
    

    You can pass Current Context to keyGenerator constructor as:

    keyGenerator obj=new keyGenerator(Current_Activity.this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to convert a string into binary using UTF-8, but i am unable
I have a problem that I want to append a string into StringBuffer object
Error: Unable to read data from the transport connection: A blocking operation was interrupted
I am unable to start the activity monitor on a different party app. When
I'm unable to execute the following prepared statement , PREPARE stmt FROM 'SELECT sb.id,sb.category,sb.make,sb.name,sb.pic,rs.slot
I am unable to change my max execution time. I have changed it in
here's my situation. I have a string containing XML data: <tag> <anotherTag> data </anotherTag>
I want to copy the a file name to a string and append .cpt
I have a very simple javascript class that does an ajax call to a
I have searched but been unable to find anything that does what I need.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.