If I substitute the Intent with a LinearLayout, just as for tab1, the
example works perfectly.  and it's not just a MapActivity, the
NullPointerException is thrown with any activity.

luka

On May 7, 9:56 pm, WildLuka <[EMAIL PROTECTED]> wrote:
> i have indeed launched MyMapActivity the canonical way, and it works
> fine ! ... sorry about the mistakes ...
> the think is that I need to show a map in a Tab and since the only way
> of running a MapView is through the MapActivity, that seemed to be the
> only viable option... i'm open to other suggestions ...
>
> let me straighten the code ...
>         TabHost.TabSpec tab2= tabs.newTabSpec("tab2");
>         tab2.setContent(new Intent(this, MyMapActivity.class));
>
> tab2.setIndicator("tab2",getResources().getDrawable(R.drawable.drawable2));
>         tabs.addTab(tab2);
>
> that's it!
>
> Thanks ...
>
> On May 7, 8:57 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
>
> > WildLuka wrote:
> > > sure !
>
> > <snip>
>
> >  >           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);
>
> > I'm assuming the second line should read:
>
> > tab2=setContent(new Intent(this, MyMapActivity.class));
>
> > and the fourth line should read:
>
> > tabs.addTab(tab2);
>
> > However, you're getting past that in your stack trace, so presumably
> > that's not your problem.
>
> > Ignoring the tabs for the moment, can you launch MyMapActivity by other
> > means? It might be worthwhile to confirm that the problem isn't that
> > MyMapActivity is somehow intrinsically un-startable (e.g., not listed in
> > the manifest).
>
> > Frankly, I have no idea how TabHost.TabSpec#setContent(Intent) is
> > supposed to work. I'm not aware of any other widget that supports
> > pulling in another whole activity as its UI representation. My gut tells
> > me that it doesn't put the other activity in a tab, but rather actually
> > starts the intended activity via the Intent, which may or may not be
> > what you're visually fishing for.
>
> > --
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to