Well, you could put a button in the MovieDetail to go back to Cinema
list, or you could modify the setCurrentTab in TabHost to not bail out
when clicking the already active tab. See lines 324-326.

On Sep 18, 1:01 pm, Wouter <wouterg...@gmail.com> wrote:
> Ok this works when i go to other tab and go back to original tab.
>
> So if i open MovieDetail in CinemaActivity (cinema tab), cinema got
> replaces by MovieDetail. if i open Video tab and go back to Cinema, it
> shows cinemaActivity again, this is good!
>
> But when i open MovieDetail in CInemaActivity (cinema tab) and click
> on cinema tab again, it doesnt change.. It has to load cinemaActivity
> again..
>
> Code:
>
> mTabHost.setOnTabChangedListener(new
> my.android.widget.TabHost.OnTabChangeListener() {
>
>           �...@override
>            public void onTabChanged(String arg0) {
>                 int selectedTab = mTabHost.getCurrentTab();
>                 System.out.println("TAB: " + selectedTab);
>
>                 if (selectedTab == 0)
>                 {
>                         refreshCinemaTab();
>                 }
>            }
>       });
>
>     }
>
>     public void refreshCinemaTab()
>     {
>         cinema.replaceContent(new android.content.Intent(this,
> CinemaActivity.class));
>     }
>
> And cinema --> tab 0
>
> How can i do this?
>
> On 18 sep, 19:28, "nEx.Software" <email.nex.softw...@gmail.com> wrote:
>
> > Register an OnTabChangeListener in your tab activity and handle it in
> > there.
>
> > On Sep 18, 10:10 am, Wouter <wouterg...@gmail.com> wrote:
>
> > > How can i do that?  It initates the tabs on create but when happens
> > > when i click on tab again.. where do i have to place the
> > > replaceContent code?
>
> > > On 18 sep, 19:01, "nEx.Software" <email.nex.softw...@gmail.com> wrote:
>
> > > > You'll have to replace the content again. :)
>
> > > > On Sep 18, 9:58 am, Wouter <wouterg...@gmail.com> wrote:
>
> > > > > Nice works great!
>
> > > > > But when i switch to other tab and go back to cinema tab my
> > > > > MovieDetail is still open and when i click on Cinema in tabs it doest
> > > > > change to my cinema activity..
>
> > > > > How can i go back now?
>
> > > > > On 18 sep, 18:49, "nEx.Software" <email.nex.softw...@gmail.com> wrote:
>
> > > > > > Well, you could do it a couple ways... One way, for example:
>
> > > > > > In CinemaActivity:
>
> > > > > > Home parentActivity = ((Home) this.getParent());
> > > > > > parentActivity.cinema.replaceContent(new 
> > > > > > android.content.Intent(this,
> > > > > > MovieDetail.class))
>
> > > > > > On Sep 18, 9:30 am, Wouter <wouterg...@gmail.com> wrote:
>
> > > > > > > Hey,
>
> > > > > > > Thank you!
>
> > > > > > > But I have some questions..
>
> > > > > > > I now declarate my tabs in Home.java (my tabs are now at bottom).
> > > > > > > I have 4 tabs: Cinema, Video,TV and search.
>
> > > > > > > These 4 tabs are 4 different activities with lists. When i click 
> > > > > > > on a
> > > > > > > list item in cinema activity I have to open MovieDetail.java (now 
> > > > > > > it
> > > > > > > opens in new activity without tabs) and the tabs have to stay at 
> > > > > > > the
> > > > > > > bottom.
> > > > > > > But how can i reach my custom tabspec cinema in CInemaActivity so 
> > > > > > > i
> > > > > > > can do replaceContent --> cinema.replaceContent(new
> > > > > > > android.content.Intent(this, MovieDetail.class));
>
> > > > > > > Wouter
>
> > > > > > > On 18 sep, 17:51, "nEx.Software" <email.nex.softw...@gmail.com> 
> > > > > > > wrote:
>
> > > > > > > > I was planning on writing a full blown tutorial but since I can 
> > > > > > > > tell
> > > > > > > > you are anxious to see it... This is a 1.5 compatible version 
> > > > > > > > that
> > > > > > > > uses modified versions of the TabActivity, TabHost, and 
> > > > > > > > TabWidget (and
> > > > > > > > related resources) from Android 1.6. There are obvious things 
> > > > > > > > that
> > > > > > > > could be done better but the idea is there and should at least 
> > > > > > > > get you
> > > > > > > > headed in the "right" direction.
>
> > > > > > > >http://nexsoftware.net/Android/Tutorials/CustomTabActivity.zip
>
> > > > > > > > On Sep 18, 6:36 am, Wouter <wouterg...@gmail.com> wrote:
>
> > > > > > > > > Thank you so much!
>
> > > > > > > > > On Sep 18, 3:03 pm, "nEx.Software" 
> > > > > > > > > <email.nex.softw...@gmail.com>
> > > > > > > > > wrote:
>
> > > > > > > > > > Sure, I'll throw together a quick sample and post it in a 
> > > > > > > > > > bit.
>
> > > > > > > > > > On Sep 18, 12:11 am, Wouter <wouterg...@gmail.com> wrote:
>
> > > > > > > > > > > And can you post the source code from this and your other 
> > > > > > > > > > > example
> > > > > > > > > > > please?
>
> > > > > > > > > > > On 17 sep, 23:50, "nEx.Software" 
> > > > > > > > > > > <email.nex.softw...@gmail.com> wrote:
>
> > > > > > > > > > > > It just worked for me...
>
> > > > > > > > > > > > That being said, I have also copied all of the relevant 
> > > > > > > > > > > > code from the
> > > > > > > > > > > > Android Open Source Project, added a 
> > > > > > > > > > > > replaceContent(Intent intent)
> > > > > > > > > > > > method, and done the same thing as before but without 
> > > > > > > > > > > > the switching to
> > > > > > > > > > > > a new tab first... Again, I am almost positive that 
> > > > > > > > > > > > this is not the
> > > > > > > > > > > > correct way to do this so I hesitate to recommend it. I 
> > > > > > > > > > > > can't say
> > > > > > > > > > > > exactly what happens to the Activity, to be honest. It 
> > > > > > > > > > > > may be hanging
> > > > > > > > > > > > out in limbo.
>
> > > > > > > > > > > > On Sep 17, 2:44 pm, Wouter <wouterg...@gmail.com> wrote:
>
> > > > > > > > > > > > > But i want to show this new activity in the same 
> > > > > > > > > > > > > active tab. now it
> > > > > > > > > > > > > opens in a new activity without showing my 3 tabs..
>
> > > > > > > > > > > > > On 17 sep, 23:28, "nEx.Software" 
> > > > > > > > > > > > > <email.nex.softw...@gmail.com> wrote:
>
> > > > > > > > > > > > > > It seems you cannot change the Activity of the 
> > > > > > > > > > > > > > current tab using
> > > > > > > > > > > > > > setContent(); That being said... Doing something 
> > > > > > > > > > > > > > you really probably
> > > > > > > > > > > > > > should not do, you can get this to work: 
> > > > > > > > > > > > > > Programmatically switch to
> > > > > > > > > > > > > > another tab (something like 
> > > > > > > > > > > > > > getTabHost().setCurrentTab(1);), then do
> > > > > > > > > > > > > > MainTabActivity.projectTab.setContent(i);, then go 
> > > > > > > > > > > > > > back to the
> > > > > > > > > > > > > > original tab (something like 
> > > > > > > > > > > > > > getTabHost().setCurrentTab(0);). Like I
> > > > > > > > > > > > > > said though... this is probably not something you 
> > > > > > > > > > > > > > should do.
>
> > > > > > > > > > > > > > On Sep 17, 1:52 pm, Wouter <wouterg...@gmail.com> 
> > > > > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > > > Does someone has found an easy solution for this? 
> > > > > > > > > > > > > > > I have the same
> > > > > > > > > > > > > > > issue. I have 3 tabs and I want to show a new 
> > > > > > > > > > > > > > > activity in one of these
> > > > > > > > > > > > > > > tabs!
>
> > > > > > > > > > > > > > > Wouter
>
> > > > > > > > > > > > > > > On Aug 12, 3:47 pm, Sena <s...@imkon.com> wrote:
>
> > > > > > > > > > > > > > > > Thanks for the pointers Mark.
> > > > > > > > > > > > > > > > S
>
> > > > > > > > > > > > > > > > On Aug 12, 3:16 pm, Mark Murphy 
> > > > > > > > > > > > > > > > <mmur...@commonsware.com> wrote:
>
> > > > > > > > > > > > > > > > > Sena Gbeckor-Kove wrote:
> > > > > > > > > > > > > > > > > > Thanks for the tip. Can you point me at 
> > > > > > > > > > > > > > > > > > what I need to be looking up to
> > > > > > > > > > > > > > > > > > find the documentation about changing the 
> > > > > > > > > > > > > > > > > > viewinsidetheTab?
>
> > > > > > > > > > > > > > > > > You don't change the Viewinsideof atab. You 
> > > > > > > > > > > > > > > > > cause the existing View
> > > > > > > > > > > > > > > > > to show something else (e.g., use FrameLayout 
> > > > > > > > > > > > > > > > > and make one layer VISIBLE
> > > > > > > > > > > > > > > > > and another layer GONE, or use ViewFlipper to 
> > > > > > > > > > > > > > > > > swap between contents).
>
> > > > > > > > > > > > > > > > > You *might* be able to get setContent() to 
> > > > > > > > > > > > > > > > > replace the current View by
> > > > > > > > > > > > > > > > > passing in another layout ID or 
> > > > > > > > > > > > > > > > > TabContentFactory, but I'm skeptical
> > > > > > > > > > > > > > > > > this will work.
>
> > > > > > > > > > > > > > > > > Thetabwidget framework in Android is designed 
> > > > > > > > > > > > > > > > > for simple stuff. You
> > > > > > > > > > > > > > > > > may wish to grab the source code for the 
> > > > > > > > > > > > > > > > > relevant classes out of Android
> > > > > > > > > > > > > > > > > and make your own version that handles your 
> > > > > > > > > > > > > > > > > own scenario.
>
> > > > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > > > > Mark Murphy (a Commons 
> > > > > > > > > > > > > > > > > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > > > > > > > > > > > > > > > Warescription: Three Android Books, Plus 
> > > > > > > > > > > > > > > > > Updates, $35/Year
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to