I have to manage different text views in tabs for chatting in android.In my code if a list item is clicked new tab will be generated having one text view one EditText box and a button.With the construction of the tab a new class having will be initialized which will check whether there is any new message or not after every 30 seconds.If new message comes then this will write to that specific text view of the tab.My sample code is follwing:ForPractice fp=new ForPractice(tabHost,"abcd");
When a tab is created this class is called.In its constructor I am sending tabtag and tabhost.And this class consists of following code: `public class ForPractice implements Runnable{
String str;
Thread thrd;
TabHost host;
public ForPractice(TabHost tabHost,String name) {
str=name;
thrd=new Thread(this, name);
this.host= host;
thrd.start();
}
@Override
public void run() {
while(true)
{
try {
str="This is for test\n";
thrd.sleep(30000);
str="";
test();
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
}
}
}
private void test()
{
// get tab by tab, where tag=str (passed during the constructor)
// access the textview in this tab
// append text(str) in that textview
}
}`----My question is how to do the codes in 'private void test()';