To elaborate, global variables a la application object are usually an anti-pattern
On Sun, Apr 8, 2012 at 9:54 PM, Kristopher Micinski <[email protected]> wrote: > Good to hear, but I agree with Gergely's advice, why are you doing > this in the first place? > > kris > > On Sun, Apr 8, 2012 at 9:37 PM, Etienne <[email protected]> wrote: >> The HashMap is valid when i put it in the Intent, and when I get it back it >> is also valid. >> >> UPDATE: >> >> So I fixed this issue. In my onActivityResult, I was iterating through the >> HashMap like so: >> >> Iterator<Entry<String, Boolean>> it = sc.entrySet().iterator(); >> while (it.hasNext()) { >> HashMap.Entry pairs = (HashMap.Entry) it.next(); >> String contactId = pairs.getKey().toString(); >> boolean selected = (Boolean) pairs.getValue(); >> if (selected) { >> selectedContactsText += getName(contactId) + ", "; >> Log.d("Messenger", getName(contactId) + " was selected"); >> Log.d("Messenger", selectedContactsText + " is the text"); >> } >> it.remove(); // avoids a ConcurrentModificationException >> } >> >> However i noticed the last statement of the while loop was in fact removing >> elements from the HashMap. >> So I commented this line out and all works as intended. >> >> On Sunday, April 8, 2012 3:28:12 PM UTC-7, TreKing wrote: >>> >>> Have you stepped through the code? Is the HahMap valid when you put it in >>> the Intent? When you get it back, is it valid then? >>> >>> >>> ------------------------------------------------------------------------------------------------- >>> TreKing - Chicago transit tracking app for Android-powered devices >>> >> -- >> 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 -- 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

