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?
Thanks
IPEntry
- Code: Select all
public class IPEntry extends Activity {
Button Submit;
EditText IP;
TextView Thistext;
public String ipadd;
public Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.ipentry);
Submit = (Button) findViewById(R.id.bIPSubmit);
Thistext = (TextView) findViewById(R.id.tvTextIP);
IP = (EditText) findViewById(R.id.edIPBar);
Submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
ipadd = IP.getText().toString();
Intent Trans = new Intent("wishift.mat.ANDROIDEXPLORER");
startActivity(Trans);
}
}
);
}}
Concerned ClientUpload Section
- Code: Select all
public class ClientUpload extends Thread{
IPEntry ipentry = new IPEntry();
public int UploadFile(File file) throws UnknownHostException, IOException
{
//loop
int serverPort = 6880;
// String ip = "192.168.1.73";
String ip = ipentry.ipadd;
Socket socket = new Socket(ip, serverPort);


