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

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -