How to reuse Activities? Not to create activity each time

后端 未结 2 1701
时光取名叫无心
时光取名叫无心 2021-02-20 14:28

This topic is continue of this: Android. How to start activity without creating new one?

I have read that activities are destroyed when to click BACK button. They can be

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 14:55

    You can redefine the "onBack" method of your activity, something like

    public void onBackPressed () 
    {
        moveTaskToBack (true);
    }
    

提交回复
热议问题