EditText to String name to different class

Put your problem here if it does not fit any of the other categories.

EditText to String name to different class

Postby esaner » Wed Apr 25, 2012 5:59 pm

Hi there,

Having a bit of problem as I would like on my application for the user to enter an IP address and for that IP entry to be used to connect to the other device. In these two classes, the IPEntry class is set up to read the IP through the EditText and get coverts it to a string. I then want it to be passed and used within my ClientUpload class. Obviously I had attempted to already solve this to no avail. When I use it with the following way it says it cannot find the IP so it isn't transferring. I also tried to get in within a method and call upon that but that didn't work either. Is there anyway to do this?


Code: Select all
public class IPEntry extends Activity {

   Button Submit;
   EditText IP;
   TextView Thistext;
   public String ipadd;
   public Intent intent;
   protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      Submit = (Button) findViewById(R.id.bIPSubmit);
      Thistext = (TextView) findViewById(R.id.tvTextIP);
      IP = (EditText) findViewById(R.id.edIPBar);   

      Submit.setOnClickListener(new View.OnClickListener() {
         public void onClick(View v) {
               // TODO Auto-generated method stub
                         ipadd = IP.getText().toString();
               Intent Trans = new Intent("wishift.mat.ANDROIDEXPLORER");

Concerned ClientUpload Section
Code: Select all
public class ClientUpload extends Thread{
   IPEntry ipentry = new IPEntry();
   public int UploadFile(File file) throws UnknownHostException, IOException

      int serverPort = 6880;                  
   //   String ip = "";
      String ip = ipentry.ipadd;
      Socket socket = new Socket(ip, serverPort);
Once Poster
Once Poster
Posts: 1
Joined: Wed Apr 25, 2012 5:46 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 20 guests