Re: [android-developers] Global variable extend application class

2012-04-08 Thread Etienne
Here is the my subclass of Application public class MyApp extends Application { private HashMapString, Boolean selectedContacts = null; public HashMapString, Boolean getSelectedContacts() { return this.selectedContacts; } public void setSelectedContacts(HashMapString, Boolean sc) {

Re: [android-developers] Global variable extend application class

2012-04-08 Thread TreKing
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 http://sites.google.com/site/rezmobileapps/treking - Chicago

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Gergely Juhász
Don't do this anyway. Creating global variable? For me it looks to a bad and ugly solution. If you want persistent data your SharedPreferences. On 9 April 2012 00:28, TreKing treking...@gmail.com wrote: Have you stepped through the code? Is the HahMap valid when you put it in the Intent? When

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Gergely Juhász
sorry your = use On 9 April 2012 01:58, Gergely Juhász jg.sv...@gmail.com wrote: Don't do this anyway. Creating global variable? For me it looks to a bad and ugly solution. If you want persistent data your SharedPreferences. On 9 April 2012 00:28, TreKing treking...@gmail.com wrote: Have

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Etienne
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: IteratorEntryString, Boolean it = sc.entrySet().iterator(); while (it.hasNext()) { HashMap.Entry

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Kristopher Micinski
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 lawloretie...@gmail.com 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.  

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Kristopher Micinski
To elaborate, global variables a la application object are usually an anti-pattern On Sun, Apr 8, 2012 at 9:54 PM, Kristopher Micinski krismicin...@gmail.com 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

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Etienne
I am using the application object to maintain global application state. What are the disadvantages of sub-classing the Application class? And what advantages do SharedPreferences have over my solution? -- You received this message because you are subscribed to the Google Groups

Re: [android-developers] Global variable extend application class

2012-04-08 Thread TreKing
On Sun, Apr 8, 2012 at 10:45 PM, Etienne lawloretie...@gmail.com wrote: I am using the application object to maintain global application state. What are the disadvantages of sub-classing the Application class? And what advantages do SharedPreferences have over my solution? I do this as

Re: [android-developers] Global variable extend application class

2012-04-08 Thread Kristopher Micinski
On Sun, Apr 8, 2012 at 11:45 PM, Etienne lawloretie...@gmail.com wrote: I am using the application object to maintain global application state. What are the disadvantages of sub-classing the Application class?  And what advantages do SharedPreferences have over my solution? I don't think

[android-developers] Global variable extend application class

2012-04-07 Thread Etienne
So I am trying extend the base android.app.Application class and add member variables to create global variables like in this first solution of the link below. Android global variablehttp://stackoverflow.com/questions/1944656/android-global-variable This works if the member variable is a

Re: [android-developers] Global variable extend application class

2012-04-07 Thread TreKing
On Sat, Apr 7, 2012 at 9:13 PM, Etienne lawloretie...@gmail.com wrote: I am setting the member variable in onActivityResult(), and i am trying to access this member variable in the onClick() method of a button's onClickListener. When i access the String variable it's value is set