sure ! public class MyMapActivity extends MapActivity {
private OverlayController mOverlayController; private MapController mapController; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); MapView mapView = new MapView(this); mapController = mapView.getController(); mOverlayController = mapView.createOverlayController(); mapController.zoomTo(9); setContentView(mapView); } } here is the tab layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TabHost android:id="@+id/tabs" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="65px" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="200px" android:paddingTop="65px" > <LinearLayout android:id="@+id/content1" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ff99ccff" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="some text here" /> </LinearLayout> </FrameLayout> </TabHost> </LinearLayout> and the onCreate in the TabsActivity @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.two_tabs); TabHost tabs = (TabHost)this.findViewById(R.id.tabs); tabs.setup(); TabHost.TabSpec tab1= tabs.newTabSpec("tab1"); tab1.setContent(R.id.content1); tab1.setIndicator("tab1", getResources().getDrawable(R.drawable.drawable1)); tabs.addTab(buddies); TabHost.TabSpec tab2= tabs.newTabSpec("tab2"); tab2= map.setContent(new Intent(this, MyMapActivity.class)); tab2.setIndicator("tab2", getResources().getDrawable(R.drawable.drawable2)); tabs.addTab(map); tabs.setCurrentTab(0); } thank you ! On May 7, 7:45 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > WildLuka wrote: > > ok ,, i've just noticed that you can pass an Intent to setContent() to > > start an activity. so I have defined and declared a MyMapActivity, > > but what I get now is a NullPointException as soon as I hit the > > MapTab ... here it is: > > > Uncaught handler: thread Main exiting due to uncaught exception > > java.lang.NullPointerException > > at android.widget.TabHost > > $IntentContentStrategy.getContentView(TabHost.java:556) > > at android.widget.TabHost.setCurrentTab(TabHost.java:238) > > at android.widget.TabHost$1.onTabSelectionChanged(TabHost.java:95) > > at android.widget.TabWidget > > $TabClickListener.onClick(TabWidget.java:134) > > Can you post: > > -- your layout > -- your MyMapActivity class (at least the class declaration and > onCreate()/onResume()/wherever you're adding your tabs to the TabHost) > > Without those, it will be difficult to determine where the problem lies. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > The Busy Coder's Guide to Android Development -- coming in June 2008! --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---