I have a custom component with one RadioGroup that has two RadioButton, ids 
@+id/radioButton1and @+id/radioButton2. On the other hand, there is a 
TabActivity with five tabs. On each tab, this component is used more than 
one time.

Here's the problem, when orientation changes and the activity is recreated, 
all of the RadioButton are loaded with the same attrs, this includes 
android:text, android:layout_margin and even the styled attrs that i've 
created. It also happens with all the CheckBox that has the same ids.

I spent some time trying to discover why this was happening and concluded 
that android is doing that in onRestoreInstanceState. If I comment the line 
that calls the super method it works fine.

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    // super.onRestoreInstanceState(savedInstanceState);

}

Is this how it's supposed to be? Or what could one do to cause this?

I'm guessing that it's not a normal behaviour because when a custom view is 
created, it inflates the same layout with the same views that has the same 
ids. So it's not possible to instantiate a new custom view generating 
different ids for its child every time. Using the code above or
android:configChanges on the manifest seems to be a bad workaround to me. 
So, any help is appreciated.

-- 
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