Sabtu, 10 Oktober 2015

Panggil Class dari Tabhost

package com.example.widget2;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabHostActivity extends TabActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tab_host);
        TabHost tabHost = getTabHost();
       
        TabSpec tGambar = tabHost.newTabSpec("Gambar");
        tGambar.setIndicator("Xml1");
        tGambar.setContent(R.id.tab1);
               
        TabSpec tAComplete = tabHost.newTabSpec("AutoComplete");
        tAComplete.setIndicator("AutoComplete");
        Intent aCompleteIntent = new Intent(TabHostActivity.this, AutoCompleteActivity.class);
        tAComplete.setContent(aCompleteIntent);
       
        TabSpec tACSQLite = tabHost.newTabSpec("AutoCompleteSQLite");
        tACSQLite.setIndicator("SQLite");
        Intent acSQLiteIntent = new Intent(TabHostActivity.this, AutoCompleteSQLite.class);
        tACSQLite.setContent(acSQLiteIntent);
       
        TabSpec tabSpec2 = tabHost.newTabSpec("Xml2");
        tabSpec2.setIndicator("Xml2");
        tabSpec2.setContent(R.id.tab2);       
       
        tabHost.addTab(tGambar);       
        tabHost.addTab(tAComplete);
        tabHost.addTab(tACSQLite);
        tabHost.addTab(tabSpec2);
    }   
}

Tidak ada komentar:

Posting Komentar