android - Launcher intent behaves like back button -


When I call intent /

  if (parentIntent == null) {parentIntent = activity.getPackageManager (). GetLaunchIntentForPackage (activity.getPackageName ()); } NavUtils.navigateUpTo (Activity, Parentmont);  

The following code works though:

  if (parentIntent == empty) {activity.startActivity (activity.getPackageManager () .getLaunchIntentForPackage (activity. GetPackageName ()) .addFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP)); Activity.finish (); } And {NavUtils.navigateUpTo (activity, parent intent); }  

Nobody knows why NavUtils behaves this way?

documentation quote:

  NavUtils.navigateUpTo (activity source activity , Intent upIntent);  

Navigate to the activity specified by the attribution from the source activity, complete the source activity in the process.

Then, NavUtils.navigateUpTo press a back button, and if you are calling the first piece of code from the Home button click listener, you will be taken back to the previous activity.


Comments

Popular posts from this blog

python - rpy2 import is not working -

c++ - How to load a bitmap from file into the samples buffer -

javascript - How to get MySQL query result returned using $.ajax -