How to programmatically pause an activity?
How can I programmatically pause an activity? I have a TabHost that is creating an activity through an Intent:
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);
I want to be able to pause the activity when my tab changes. How can I pragmatically开发者_如何转开发 pause an activity?
Activity will always be paused if it is not in view. Read here http://developer.android.com/guide/topics/fundamentals.html#actlife
精彩评论