简体   繁体   English

android tabhost的活动生命周期

[英]the activity life cycle of the android tabhost

I am trying to use a tabhost that contains 3 tabs我正在尝试使用包含 3 个选项卡的选项卡主机

I also have a button within the tabhost that can be clicked no matter what activity is in the frameLayout.我在 tabhost 中还有一个按钮,无论 frameLayout 中有什么活动,都可以单击该按钮。 (this button returns back to a previous non tab activity) (此按钮返回到以前的非选项卡活动)

When one of my tab activites is paused it stores some information.(So every time i switch tab information is stored).当我的一个选项卡活动暂停时,它会存储一些信息。(所以每次我切换选项卡时都会存储信息)。

what i am having trouble with is, when i press the button, i call我遇到的问题是,当我按下按钮时,我打电话

TabbedActivity.this.finish();

the onPause and onStop method of the activity within the frame layout is not called.不调用框架布局内活动的 onPause 和 onStop 方法。

how would i go about calling these methods before i call the .finish() method在调用.finish()方法之前,我将如何调用这些方法?

To ensure my onPause method was called.... i just called为了确保我的 onPause 方法被调用......我刚刚调用了

if(tabHost.getCurrentTab() !=0){
                tabHost.setCurrentTab(0);
            }else{
                tabHost.setCurrentTab(1);
            }


            PinMeTabbedActivity.this.finish();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM