I am trying to start a thread in every activty oncreate method and after certain time i want to finish the activty from the thre开发者_如何学Cad calss using finish() method but finish method needs to extend activty class.so, how can i get the activty on top in my thread class..?
Parse the activity to the thread in its constructor:
public MyThread( Activity activity ) {
this.activity = activity;
}
And when you want to end the activity from the thread-class you call:
activity.finish();
精彩评论