onRestoreInstanceState exception only on froyo for a simple textview

by Cheryl Sedota » Fri, 13 Aug 2010 23:15:35 GMT


Sponsored Links
 I have an application with an activity group, and it uses the local
activity manager class to start a subactivity and insert that
subactivity's view.  I do not have any custom onSaveInstanceState
logic written anywhere in my app.  I have a nested layout of relative
layout -> textview within that subactivity's view, and the text view's
id is "recent_apps_label".  I get this exception every time I rotate
the device to/from portrait/landscape orientation on froyo ONLY, never
saw this on eclair.

Please help - I have NO idea as to how the parcelable object getting
sent to onRestoreInstanceState would be for a list view.  I even
changed the id to something even more unique and it didn't fix the
problem.  I have a different layout file for the containing layout in
layout-land-mdpi, layout-port-mdpi, and layout-port-hdpi FYI.

Here is the exception:

E/AndroidRuntime( 1106): java.lang.IllegalArgumentException: Wrong
state class, expecting View State but received class
android.widget.AbsListView$SavedState instead. This usually happens
when two views of different type have the same id in the same
hierarchy. This view's id is id/recent_apps_label. Make sure other
views do not use the same id.
E/AndroidRuntime( 1106):        at
android.view.View.onRestoreInstanceState(View.java:6162)
E/AndroidRuntime( 1106):        at
android.widget.TextView.onRestoreInstanceState(TextView.java:2422)
E/AndroidRuntime( 1106):        at
android.view.View.dispatchRestoreInstanceState(View.java:6138)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.View.restoreHierarchyState(View.java:6117)
E/AndroidRuntime( 1106):        at
com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:
1530)
E/AndroidRuntime( 1106):        at
android.app.Activity.onRestoreInstanceState(Activity.java:843)

--



onRestoreInstanceState exception only on froyo for a simple textview

by Cheryl Sedota » Fri, 13 Aug 2010 23:29:07 GMT


  subclasses TextView for this one control and logged calls to
onSaveInstanceState and onRestoreInstanceState - I never return an
AbsListView.SavedState in onSaveInstanceState but I am seeing it get
sent to my onRestoreInstanceState method:

I/TestTextView( 1739): In onSaveInstanceState with
android.view.abssavedstat...@400bae90
I/TestTextView( 1739): In onSaveInstanceState with
android.view.abssavedstat...@400bae90
I/TestTextView( 1739): In onSaveInstanceState with
android.view.abssavedstat...@400bae90
I/TestTextView( 1739): In onRestoreInstanceState with
android.view.abssavedstat...@400bae90
I/TestTextView( 1739): In onSaveInstanceState with
android.view.abssavedstat...@400bae90
I/TestTextView( 1739): In onRestoreInstanceState with
AbsListView.SavedState{45128f10 selectedId=-9223372036854775808
firstId=1 viewTop=0 position=0 height=455 filter=null}

On Aug 13, 10:15am, Cheryl Sedota <cherylsed...@gmail.com> wrote:

--


Sponsored Links


onRestoreInstanceState exception only on froyo for a simple textview

by Cheryl Sedota » Sat, 14 Aug 2010 00:54:46 GMT


 t appears that there is a bug in android where subactivities' views
are not kept isolated from each other (like AppWidgetHostView does).
Android generates the same set of id's across applications and I found
that another subactivity in the activity group has the same id
assigned to it and it's a list view. I am going to suppress saving
instance state for now, as a temporary fix but I understand that won't
enable me to get the default state saving functionality built into
android. Should I open a bug?

On Aug 13, 10:28am, Cheryl Sedota <cherylsed...@gmail.com> wrote:

--



Other Threads

1. what's meands of oneway interface ?

hi all.
I read some aidl file  that use the oneway. and I don't know what's
means of it?

thanks in advance.

-- 

2. Device Buying Club

I'm up in Canada and it's almost impossible to get hardware up here... 
things that could easily be sold aren't for no apparent good reason than 
that the company that released the product didn't think to put it through 
their Canadian reseller channels.

However, sometimes we do get the good stuff that you folks down in the US 
don't.

The first thing I'm about to try is talking to some of the smaller carriers 
up here (we have several new ones:  http://mobilicity.ca/ 
 http://www.windmobile.ca/ ) to see if they will set up a developer package 
where we can open an account with them, and buy phones from them. It would 
be to both our advantage.

So, next plan of attack; I was thinking it might be helpful to set up some 
sort of developer buying club, maybe using PayPal escrow to get devices into 
the hands of the people that need them. Not sure exactly of details, but I'm 
getting very tired of not being able to purchase something, simply because 
someones order page won't accept a canadian address, or their shipping deal 
doesn't cover canada (you'd be surprised how often those are actual 
reasons).

I'm thinking that people could buy phones and ship them to others, maybe for 
a small fee or something the details could be worked out.
Admittedly, at this point most orders would go from the US outward, but its 
possible for things to come back the other way (like some of the cool stuff 
that comes out in Europe and never sees the light of a North American day). 
I know there are many companies here in Toronto that would be interested int 
he idea as well.

Is anyone else interested in setting up some sort of dev buying club to get 
devices where they need to go?
If you are, send me a "Reply to Author" and include your location. If I can 
get enough people we'll set up a private discussion on how this should be 
organized.

Also, if you know a better way, or some way that already exists, I'm not 
into reinventing the wheel, so let s all know :)

- Brill Pappin



-- 

3. NFC test hardware for Android 2.3

4. ContactManager sample app (api version 7) stopped unexpectedly : Need Help

5. Changing Phone Settings

6. setting size of a SurfaceView

7. about sync