I am developing a one chat application. in which first screen has one button for continue and it redirects to home/main screen of window.In main screen i have five different tabs.
My main problem is that when i am on main screen and if i press back button,it redirects to home screen of device.but if clicked on launcher icon again application doesn't start from last state rather it starts from first screen.
If i press home button within any tab/screen then its working fine.clicking on launcher icon it redirects me to the last state/screen.
I want the same behaviour of home button on back button.
And i have noticed one thing this happens only on activity which has tab. on other activities even pressing a back button .application doesn't minimizes.
any solution for this?
use
public void onBackPressed() {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.