hey Sarwar,
Its working :) Thank you so much for your patience. Actually a pretty
simple approach.
Regards

On Aug 2, 9:05 pm, Sarwar Erfan <[email protected]> wrote:
> Hi,
> Well, I previously ignored the issue that your Activity1 and Activity2
> are not being displayed individually.
> Here is the solution:
>
> 1. DELETE ALLorientationchanging code from Activity1 and Activity2
> (YES, completely DELETE). They are in your onCreate (in both
> activities)
>
> 2. In you TabLayout, implement OnTabChangeListener
> public class TabLayout extends TabActivity implements
> TabContentFactory,OnTabChangeListener{
>
> 3. in onCreate of your TabLayout, after adding the two tabs, set the
> listener
> tabHost.setOnTabChangedListener(this);
>
> 4. The onTabChanged method in TabLayout.
> @Override
>         public void onTabChanged(String arg0) {
>
>                 if(arg0.equals("tab1")){
>             if(this.getRequestedOrientation() !=
> ActivityInfo.SCREEN_ORIENTATION_PORTRAIT){
>
> this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
>             }
>                 }
>                 else if(arg0.equals("tab2")){
>             if(this.getRequestedOrientation() !=
> ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE){
>
> this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
>             }
>                 }
>
>         }
> //-------------------------------------
>
> Note: This will not prevent the recreation, you dont need to to
> prevent it now I think.
>
> Let me know if it worked.
>
> Regards
> Sarwar Erfan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to