I want to manage back button Activity with noHistory.
I add Two different Layout XML add With condition like this :
if(a == 0){attch onexml} if(a == 1){attch secondxml}
when i reach secondxml from onexml , press back button its going to MainActivity , But i want to going onexml.and i used this type of code :
setSupportActionBar(cat_toolbar)
cat_toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp)
cat_toolbar.setNavigationOnClickListener {
startActivity(Intent(applicationContext, MainActivity::class.java))}
i attach two different activity_xml in single Activity using if condition . my App flow is
MainActivity -> (if(a == 0)onexml)
if(a == 1)secondxml).
Start app with MainActicity then click on button goto WorkActivity but first view onexml . again click button of onexml going to secondxml. when i press backbutton of toolbar , it going to MainActivity but i want to goto first onexml and then press back for MainActivity.
@Override
public void onAttach(Activity activity) {
cat_toolbar.setNavigationOnClickListener {
startActivity(Intent(applicationContext, MainActivity::class.java))}
}
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.