Starting intent after Async task gets over

后端 未结 3 1227
隐瞒了意图╮
隐瞒了意图╮ 2021-01-26 20:17

I created a login activity for my Android app. After the user enters the correct credentials, the login activity will switch over to the homepage but I don\'t know why my code w

3条回答
  •  粉色の甜心
    2021-01-26 20:56

    I don't think you have added the Intent code here that will help you switch to another Activity.

    protected void onPostExecute(String file_url) { 
    
        // dismiss the dialog once done             // Intent Code Missing.
    
        pDialog.dismiss(); 
    

    You should do a UI work in UI thread and Non-UI work in Non-UI thread, thats a rule from the arrival of HoneyComb version of android.

    You have added the below code in doInBackground(), That should be in onPostExcute()

    Intent homepage = new Intent( getApplicationContext(), HomepageEmployerActivity.class); 
    homepage.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
    startActivity(homepage);
    

提交回复
热议问题