Sunday, July 24, 2011

[android-developers] Re: starting Activity in tabbed UI from onTabChangedListener()

On Jul 24, 11:13 am, Marcin Orlowski <webnet.andr...@gmail.com> wrote:
> Hi
>
> I got tabbed UI, where I use own tab layout by utilising
> TabSpecs.setContent() to provide custom layout. As I wanted tab content to
> be Activites not Views, I set onTabChangedListener() to do the job, with no
> much success:
>
> public class MainActivity extends TabActivity {
> .... onCreate() {
>
>         mTabHost = (TabHost)findViewById(android.R.id.tabhost);
>         mLocalActivityManager = getLocalActivityManager();
>         mTabHost.setup(mLocalActivityManager);
>
> }
> }
>
> and listener:
>
> public void onTabChanged(String tag) {
> intent = new Intent().setClass( context, NextActivity.class);
> mLocalActivityManager.startActivity(tag, intent);
>
> }
>
> Listener's onTabChanged() is called, but nothing else happens, nor crashes,
> nor logs. Hints?
>
> PS: I also failed to follow reasoning why seting intent (so the content tabs
> points to) equals setting view of tab itself (it all falls under
> ContentStrategy in TabHost).
> PPS: Fragments, I know, I know.

See what mLocalActivityManager.startActivity() returns. You have to
attach returned Window (or its root View) to your tab

pskink

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment