I've created a nested class within my Activity
public class MissionsActivity extends Activity {
class UpdateMissions implements Runnable {
@Override
public void run() {
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
[...]
}
[...]
}
In the thread I have to read a file and update some TextFields
in the layout. I've tried implementing the run()
method with a while(true)
that reads and updates the fields, but the app just crashes when I start that Activity
.
UPDATE: I've called the execute()
method inside the onCreate()
method of the UI Activity. The Task is only working the first time I enter the Activity, if i change and go back it won't do anything.