Example usage for android.widget TabHost getTabContentView

List of usage examples for android.widget TabHost getTabContentView

Introduction

In this page you can find the example usage for android.widget TabHost getTabContentView.

Prototype

public FrameLayout getTabContentView() 

Source Link

Document

Get the FrameLayout which holds tab content

Usage

From source file:com.redhorse.quickstart.AppConfig.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    dbStart = new dbStartConfigAdapter(this);
    dbStart.open();/*from w  ww .  j  a v  a  2 s.  c  om*/

    loadApps(); // do this in onresume?

    setContentView(R.layout.applist);
    TabHost mTabHost = (TabHost) findViewById(R.id.tabhost);
    mTabHost.setup();
    LayoutInflater inflater_tab1 = LayoutInflater.from(this);
    inflater_tab1.inflate(R.layout.grid1, mTabHost.getTabContentView());
    inflater_tab1.inflate(R.layout.grid2, mTabHost.getTabContentView());
    mTabHost.addTab(mTabHost.newTabSpec("tab_test1")
            .setIndicator("", getResources().getDrawable(R.drawable.btn_add)).setContent(R.id.list1));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test2")
            .setIndicator("", getResources().getDrawable(R.drawable.btn_remove)).setContent(R.id.list2));
    mList = (GridView) findViewById(R.id.list1);
    mList.setAdapter(new AppsAdapter());
    mList.setOnItemClickListener(Grid1ItemClickListener);
    mList2 = (GridView) findViewById(R.id.list2);
    mList2.setAdapter(new AppsAdapter2());
    mList2.setOnItemClickListener(Grid2ItemClickListener);
    Button button = (Button) findViewById(R.id.Button01);
    button.setOnClickListener(Button01Listener);
    button = (Button) findViewById(R.id.Button02);
    button.setOnClickListener(Button02Listener);
    button = (Button) findViewById(R.id.weibolist);
    button.setOnClickListener(weibolistListener);
}