http://groups.google.com/group/android-developers/browse_thread/thread/78738d5f25f73db8#
On Mar 31, 3:23 pm, Jayanthi <jaia...@gmail.com> wrote: > Hi , > I need sample example for Adding tabs in new sdk version ,below > is my code i get error in that > package com.zsl.HoneycombTab; > > MY CODE: > > import android.app.TabActivity; > import android.content.Intent; > import android.content.res.Resources; > import android.os.Bundle; > import android.util.Log; > import android.widget.TabHost; > import android.widget.TabHost.TabSpec; > > public class HoneycombTab extends TabActivity > { > /** Called when the activity is first created. */ > > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > TabHost tabs = (TabHost)findViewById(R.id.tabhost); > > tabs.setup(); > Log.e("Test","1"); > Resources res = getResources(); > // TabHost.TabSpec spec; > Intent intent; > intent=new Intent().setClass(this,Tab2.class); > TabSpec spec = tabs.newTabSpec("Tweets"); > > spec.setIndicator("",res.getDrawable(R.drawable.selecttweets)).setContent(intent); > Log.e("Test","2"); > tabs.addTab(spec); > intent=new Intent().setClass(this,Tab3.class); > TabSpec spec1 = tabs.newTabSpec("Retweets"); > > spec1.setIndicator("",res.getDrawable(R.drawable.selectretweets)).setContent(intent); > Log.e("Test","3"); > tabs.addTab(spec1); > intent=new Intent().setClass(this,Tab4.class); > TabSpec spec2 = tabs.newTabSpec("Favourites"); > Log.e("Test","1"); > > spec2.setIndicator("",res.getDrawable(R.drawable.selectfavourites)).setContent(intent); > tabs.addTab(spec2); > > } > > } > > My XML file: > > <?xml version="1.0" encoding="utf-8"?> > > <LinearLayout > android:id="@+id/linearLayout1" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > xmlns:android="http://schemas.android.com/apk/res/android"> > > <TabHost > android:id="@+id/tabhost" > android:layout_width="match_parent" > android:layout_height="match_parent"> > > <LinearLayout > android:layout_width="match_parent" > android:id="@+id/linearLayout2" > android:layout_height="match_parent" > android:orientation="vertical"> > > <TabWidget > android:layout_width="match_parent" > android:layout_height="wrap_content" > android:id="@+id/tabs"></TabWidget> > > <FrameLayout > android:layout_width="match_parent" > android:layout_height="match_parent" > android:id="@+id/tabcontent"> > > </FrameLayout> > </LinearLayout> > </TabHost> > </LinearLayout> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en