Welcome, guest! Login / Register - Why register?
[ Pastes: 81368 ] [ Members: 2148 ]

Paste

Short URL: http://goo.gl/e5GU7
Pasted as Java by tabview.java on Monday, January 23rd, 2012 10:56pm ( 5 years ago )
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);
       
    }}

 

Revise this Paste

Your Name:
Code Language:

To minimise the influx of spam: you are required to register to post any code.