package ml.ml;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Window;
import android.widget.TabHost;
public class tabview extends TabActivity {
Bundle tab_intent;
public static String name, from;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.viewtab);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
// Initialize a TabSpec for each tab and add it to the TabHost
intent = new Intent().setClass(this, specification.class);
spec = tabHost.newTabSpec("Spcefication").setIndicator("Spcefication",
res.getDrawable(R.drawable.spec1))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(2);
// Do the same for the other tabs
intent = new Intent().setClass(this, audio.class);
spec = tabHost.newTabSpec("Gallery").setIndicator("Images",
res.getDrawable(R.drawable.ima))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, video.class);
spec = tabHost.newTabSpec("Videos").setIndicator("Videos",
res.getDrawable(R.drawable.videoicon))
.setContent(intent);
tabHost.addTab(spec);
}}
Add a code snippet to your website: www.paste.org