如何以编程方式暂停活动?

问题描述 投票:1回答:1

我如何以编程方式暂停活动?我有一个通过Intent创建活动的TabHost:

Intent intent;  // Reusable Intent for each tab

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, ARActivity.class);
        intent.putExtras(b);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("trending").setIndicator("Trending",res.getDrawable(R.drawable.icon)).setContent(intent);
        tabHost.addTab(spec);

我希望选项卡更改时能够暂停活动。如何实用地暂停活动?

java android android-activity android-intent android-tabhost
1个回答
1
投票

如果看不到活动,则该活动将始终被暂停。在这里阅读http://developer.android.com/guide/topics/fundamentals.html#actlife

© www.soinside.com 2019 - 2024. All rights reserved.