Anbei ein Codebeispiel, wie bekomme ich aus der Testklasse die Variable Message
[Java]
package com.thread;
import android.os.Looper;
import android.widget.TextView;
public class MyRunnable2 implements Runnable {
private String server;
private String user;
private String password;
private Integer port;
private String file_dateiname;
private TextView text_message;
private Integer connections;
private testclass test;
public MyRunnable2(String file_dateiname, String server, String user, String password, Integer port, Integer connections){
this.server = server;
this.user = user;
this.password = password;
this.port = port;
this.file_dateiname = file_dateiname;
this.connections = connections;
}
public void run(){
Looper.prepare();
test = new testclass();
Looper.loop();
}
}
//-------------------------------------------------------------------------------------------------------
package com.thread;
public class testclass extends Thread_testActivity {
public String message;
public testclass(){
message = "Nachricht";
}
String returnValue(){
return message;
}
}
//-------------------------------------------------------------------------------------------------------
package com.thread;
import android.app.Activity;
import android.os.Bundle;
public class Thread_testActivity extends Activity {
/** Called when the activity is first created. */
public String ausgabe;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Runnable r2 = new MyRunnable2("datei", "server", "user", "passwort", 80, 8);
Thread t2 = new Thread(r2);
t2.start();
}
}
[/code]