It's ok except when you need the views to save their state. The id is what identifies views when their state is saved so the toolkit simply think that your two list views are the same. But that's true within an activity only.
On Wed, May 6, 2009 at 11:44 AM, Toph <[email protected]> wrote: > > Yes they do, but is that wrong? I thought it was ok to have multiple > views with the same id. They are part of 2 different activities that > share a common layout. > > > On Apr 27, 10:17 pm, Romain Guy <[email protected]> wrote: >> Your two list views probably have the same id. >> >> >> >> On Sat, Apr 25, 2009 at 11:00 AM, Chris <[email protected]> wrote: >> >> > Hi, >> >> > I have TabActivity that uses 2 other ListActivities for the tabs. >> > Both underlying ListViews are set to CHOICE_MODE_MULTIPLE. >> > When I run the following sequence of events, I get a strange result: >> > 1) Setup one activity (tab) and its ListView using a CursorAdapter, >> > including checking some items on the list >> > 2)Reorientthescreen(openthekeyboard) >> > 3) Setup the second activity (tab) and its ListView using a >> > CursorAdapter, including checking some items on the list >> > 4) Switch back to the first tab >> >> > At this point, I can see in Eclipse that although (of course) each >> > ListView is a distinct object, the internal variable used to store the >> > checked state of items, called mCheckStates, is the SAME OBJECT >> > REFERENCE in each of the ListViews. >> >> > Clearly this is an issue, since the two views should not share the >> > checked state of items between them. >> >> > If I skip step #2, this does not occur >> >> > Here is a bit more detail: >> > After Step 1: ListView1 is object reference @1, ListView1.mCheckStates >> > is object reference @2 >> > After Step 2: ListView1 is object reference @3, ListView1.mCheckStates >> > is object reference @4 (the reorientation recreates the views) >> > After Step 3: ListView2 is object reference @5, ListView1.mCheckStates >> > is object reference @2 <-- note the reuse of this reference from step >> > #1, not sure how/why >> > After Step 4: ListView1 is object reference @3 (unchanged), >> > ListView1.mCheckStates is object reference @2 (changed) <-- same as >> > ListView2.mCheckStates >> >> > Please help >> >> > Thanks >> >> -- >> Romain Guy >> Android framework engineer >> [email protected] >> >> Note: please don't send private questions to me, as I don't have time >> to provide private support. All such questions should be posted on >> public forums, where I and others can see and answer them > > > -- Romain Guy Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

