I have implemented a thread in android which refresh the fragment (some text list ) for every 1 second .
its giving the runtime error while calling the fragment method at thread ,. here is my code
public class RunThreadExtended extends Activity implements Runnable
{
public void run() {
while(true)
{ try {
Thread.sleep(1000);
AndroidListFragmentActivity.strup++;
MyListFragment1 fragmentB = (MyListFragment1)getFragmentManager().findFragmentById(R.id.fragment1);
fragmentB.updatefrag();
} catch (InterruptedException e) {
e.printStackTrace();
}
}}}
If I call the fragment method from Mainactivity everything works from , since I need to refresh the thread for every 5 seconds in the backgroud I have implemented like this , but its not working ..pls suggest solution ...