I have a MainActivity that uses fragments.
OnCreate of MainActivity terminates onCreate with
welcomeFragment = new MyWelcomeFragment(); fr.beginTransaction().replace(R.id.mainContent, welcomeFragment).commit()
As part of MyWelcomeFragment on onResume, the stream begins to receive updates from my web server. If a user selects an action before the thread completes and switches to MyNewsFragment, what happens to a thread that is not already running in the MyWelcomeFragment thread?
The theme was created using: (myThread and the handler are instance variables)
myThread = new Thread(new Runnable() { @Override public void run() { sendDataToServer(""); handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { public void run() { onTaskDone(); } }); } }); myThread.start();
source share