Android finishAndRemoveTask dosenot start second activity -


android finishandremovetask dosenot start second activity

this first activity

intent = new intent(currentact.this, secondact.class); i.addflags(intent.flag_activity_new_task);                 i.putextra("abcd", j);                 startactivity(i);                 finishandremovetask(); 

if dont add finishandremovetask(); works fine secondact starts

this manifest

       <activity         android:name="currentact"         android:nohistory="true"         android:theme="@style/theme.appcompat.translucent"         android:taskaffinity=".shortcutactivity">      </activity>      <activity         android:name="secondact"         android:nohistory="true"          android:theme="@style/theme.appcompat.light.noactionbar.fullscreen"         android:taskaffinity=".shortcutactivity"> 

shortcutactivity mainactivity

how can start second activity , remove first activity stack also

you should add flag flag_activity_clear_task launching intent.

intent intent = new intent(this, activity.class); intent.setflags(intent.flag_activity_new_task |                 intent.flag_activity_clear_task); startactivity(intent); 

referring docs:

if set in intent passed context.startactivity(), flag cause existing task associated activity cleared before activity started. is, activity becomes new root of otherwise empty task, , old activities finished. can used in conjunction flag_activity_new_task.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -