如何最大限度地减少在Android的整个应用程序? [英] How to minimize whole application in android?
问题描述
我开发的Android application.more超过我已经completed..but我希望尽量减少option.i已经使用,我希望尽量减少tab.when用户点击最小化标签,以减少整个应用程序选项卡bar.in。 我的TabBar code为..
i was developed android application.more over i have completed..but i want to minimize option.i have used tab bar.in that i want to minimize tab.when user click minimize tab to minimize whole application. my tabbar code as..
public class tabbar extends TabActivity implements OnTabChangeListener {
private Context mContext;
TabHost tabHost;
int tabload=0;
private AlertDialog alertDialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabbar);
//mContext=this;
/** TabHost will have Tabs */
tabHost = (TabHost)findViewById(android.R.id.tabhost);
tabHost.setOnTabChangedListener(this);
/** TabSpec used to create a new tab.
* By using TabSpec only we can able to setContent to the tab.
* By using TabSpec setIndicator() we can set name to tab. */
/** tid1 is firstTabSpec Id. Its used to access outside. */
TabSpec firstTabSpec = tabHost.newTabSpec("tab_id1");
TabSpec secondTabSpec = tabHost.newTabSpec("tab_id2");
TabSpec thirdTabSpec = tabHost.newTabSpec("tab_id3");
/** TabSpec setIndicator() is used to set name for the tab. */
/** TabSpec setContent() is used to set content for a particular tab. */
firstTabSpec.setIndicator("FRIENDS").setContent(new Intent(this,view_friends.class));
secondTabSpec.setIndicator("GROUPS").setContent(new Intent(this,groups.class));
thirdTabSpec.setIndicator("SIGN OUT").setContent(new Intent(this,signout.class));
/** Add tabSpec to the TabHost to display. */
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
tabHost.addTab(thirdTabSpec);
}
@Override
public void onTabChanged(String tabId) {
// TODO Auto-generated method stub
for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
{
tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#343333")); //unselected
}
tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()).setBackgroundColor(Color.parseColor("#f1a026")); // selected
// if(tabId.equals("tab_id1")){
// LocalActivityManager manager = getLocalActivityManager();
// manager.destroyActivity("tab_id1", true);
// manager.startActivity("tab_id1", new Intent(this, view_friends.class));
// }
}
@Override
protected void onDestroy() {
super.onDestroy();
tabHost.setCurrentTab(2);
System.gc();
}
}
在此code。如果任何修正需要请帮助...
In this code if any correction need please help...
给我一个样品code ..
give me a sample code..
推荐答案
我不知道你的意思是通过最小化的东西。如果你想隐藏您的应用程序和present你可以使用下面的意图主屏幕上的用户。
I'm not sure what you mean by minimize. If you want to hide your app and present the user with the homescreen you can use the following intent.
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
虽然Home键是绰绰有余的,如果用户想隐藏你的应用程序
Although the Home button is more than sufficient if a user wants to hide your app
这篇关于如何最大限度地减少在Android的整个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!