You need to use singleTask
launchMode for the activity which you starts on tap of restart.
singleTask
If there is no that singleTask Activity instance existed in the system yet, new one would be created and simply placed on top of stack in the same Task.
But if there is an existed one, all of Activities placed above that singleTask
Activity would be automatically and cruelly destroyed in the proper way (lifecycle trigged) to make that an Activity you want to appear on top of stack. In the mean time, an Intent
would be sent to the singleTask Activity
through the lovely onNewIntent()
method.
So you need to write activity entry in manifest as
<activity
android:name=".YouSecondActivity"
android:label="singleTask launchMode"
android:launchMode="singleTask">
Please see android:taskAffinity
documentation also. Although you do not require here but you should know about it.
References are Understand Android Activity's launchMode: standard, singleTop, singleTask and singleInstance and Android Activity “launchMode” Explained , Must know for Android Development.