Finish the calling activity when AsyncTask completes

后端 未结 6 1486
挽巷
挽巷 2020-12-16 15:41

My calling activity:

public class Hello extends Activity {  

public void onCreate(Bundle savedInstanceState) {

    MyTask mt = new MyTask(this);
    mt.exe         


        
6条回答
  •  鱼传尺愫
    2020-12-16 15:52

    ((Activity)mContext).finish();
    

    Would be the correct way to cast a Context to an Activity and call its finish() method. Not sure why you'd want to finish an Activity from an AsyncTask though

提交回复
热议问题