user1254554
user1254554

Reputation: 203

android threading with activity;

In my activity class i created a obj from other java file in the same package , now that the work is finished in runnable , how do i come back to my activity class from where the thread was started.

consider this situation;

public class myActivity extends activity {
  MyThread t;

  public void onCreate(Bundle savedInstanceState) {
    t = new Mythread();
    t.start();
  }
}

now t is simple java class which does some background checking of data , but I dont know how to come from this t.run() method to my activity so that I can jump to another activity from there.any help is appreciated.I am new to this scenario.Thanks in advance.

Regards, Rohit

Upvotes: 1

Views: 70

Answers (1)

Dirk Jäckel
Dirk Jäckel

Reputation: 3025

You should consider using an AsyncTask for this.

Put in onBackground() what needs to be done in the background and in onPostExecute() what needs modify the UI.

Upvotes: 3

Related Questions