I am stuck with my issue.Thing is that its a custom Tab Widget.In that have multiple
tab like Home – News – Abc – PQR .
The Activity should be for both orientation like portrait and landscape. so for that each tab have two xml for portrait which is store at layout-port/file.xml and landscape which store at layout-land/file.xml
For manage orientation portrait to landscape i have added android:configChanges="orientation|keyboardHidden" rule tag in each activity.
TAB_SAMPLE.javaTab file.TAB_GROUP_ACTIVITYeach Tab Group activity Filefile.javaTask file
After all this stuff i get issue here :
If i addandroid:configChanges=”orientation|keyboardHidden”rule tag in tab_sample activity then its working perfect. like manage different view. port to land and land to port but its not working in Home.java.
Now if i remove android:configChanges="orientation|keyboardHidden" rule tag in tab_sample activity then its working for Home activity not for News.java
Mean when i change the orientation its keeping same xml form port not use from layout-land.in the sense its call OnCreate() again.
So as i found may be issue is in Tab Widget.
Update
Now after tracing my code i get that main issue is in grid view activity because its only activity which is not working.
Issue is between Tab host v/s Grid View. I don’t know why its not taking layout-land xml file. i found this as same issue but no replay on that question also
see in Detail manifestfile.xml
I want to maintain both portrait and landscape in all activity.
Please help me how to solve this.
Oooohhh Finally i got the solution for above issue. It’s was very difficult.
For maintain the state of orientation Landscape to portrait and vice-versa we generally adding
android:configChanges="keyboardHidden|orientation"property tag under activity.But here
may be issue is Tab_Group_ Activitydue to that i am not able to maintain state in GridView.Grid_File.javais Only single java file which was not handling the orientation rest of all other working perfectly.Now if i
remove android:configChanges="keyboardHidden|orientation"fromTAB_SAMPLE.javathen Its handling onlyGrid_File.javanot others.Here is my solution:
I have
add android:configChanges="keyboardHidden|orientation"inTAB_SAMPLE.javaas well asimplement onConfigurationChanged(Configuration newConfig)and set Number of column of grid. likegridView.setNumColumns(6);Generally we are adding either
android:configChanges="keyboardHidden|orientation"tag under activity orimplementing onConfigurationChanged(Configuration newConfig)but here i have written both.