Issue
Flow:
- Open app (MainActivity)
- Press home button ( calling onPause() in activity )
Starting same activity, with different intent
Intent intent = Utils.createIntent(....., this, MainActivity.class); // this will add some extra to our intent intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent);
Nothing happens.
onCreate() gets called. (onDestroy wasn't called)
onResume() is called
My activity in xml
<activity
android:name=".ui.activities.MainActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
NOte: if I don't press home button (app doesn't pause), onNewIntent will be called correctly.
Solution
Try to set this Flags:
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
You are welcome!
Answered By - Volodymyr Kulyk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.