【问题标题】:How to programmatically pause an activity?如何以编程方式暂停活动?
【发布时间】:2011-05-06 22:29:58
【问题描述】:

如何以编程方式暂停活动?我有一个通过 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】:

如果不在视图中,Activity 将始终暂停。阅读这里http://developer.android.com/guide/topics/fundamentals.html#actlife

【讨论】:

    猜你喜欢
    • 2022-08-11
    • 2017-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多