android - Launcher intent behaves like back button -
When I call The following code works though: Nobody knows why intent /
if (parentIntent == null) {parentIntent = activity.getPackageManager (). GetLaunchIntentForPackage (activity.getPackageName ()); } NavUtils.navigateUpTo (Activity, Parentmont);
if (parentIntent == empty) {activity.startActivity (activity.getPackageManager () .getLaunchIntentForPackage (activity. GetPackageName ()) .addFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP)); Activity.finish (); } And {NavUtils.navigateUpTo (activity, parent intent); }
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
Post a Comment