[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Florian Lettner
public static ServerConnection getInstance() {       if(m_connection == null)           m_connection = new ServerConnection();       return m_connection; } Actually I've done it this way, was just a writing error -- You received this message because you are subscribed to the Google

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Florian Lettner
However, thank you very much for your help. Also tried to implement it without singleton now and I just have the same weired problem :-( On 6 Feb., 18:49, Bob Kerns r...@acm.org wrote: In addition to the comment/correction by Streets of Boston... It's unclear from your description just

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Florian Lettner
It's unclear from your description just where you're storing your non- static variables. The right way would appear to be in your ServerConnection instance, since that's the static singleton. Your activity will have a much shorter lifespan. The variables are stored as class members in the

Re: [android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Michael Rueger
On 2/8/2010 11:58 AM, Florian Lettner wrote: afterwards connect() is called which uses the member variable, the member has got its initial value again, like it is a different object. Is it the inital value from a variable initialization? (e.g. int variable = 0; ) If so, what I ran into is

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Streets Of Boston
Did you check if you service is being destroyed (onDestroy) or being killed (entire service process is being killed by Android) and re- created later at points in your code that are unexpected? Put break-points in your service's onCreate, onDestroy and onBind and see what's going on. Another

Re: [android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Michael MacDonald
On 02/08/10 10:30, Streets Of Boston wrote: Did you check if you service is being destroyed (onDestroy) or being killed (entire service process is being killed by Android) and re- created later at points in your code that are unexpected? Put break-points in your service's onCreate, onDestroy

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Florian Lettner
But in that case the ctor of the singleton class must have been called a second time, right? Since I've only got one single call of the ctor I guess the instance only exists one time!? I thought of that too. So what I do is, I call the startService() method from my acivity to create a new

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Matt Kanninen
When I unexpectedly saw important, small, static strings get cleared, my solution was to surround them with getters and setters, and check if they were null each time. In the setter I would write them to private internal storage, and in the getter, if I found a null I'd check if they were stored

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Mike Collins
Some thoughts, Is your service delcared remote in the manifest? If so you do know how to debug into both processes simultaneously? The order of initialization of class variables can get complicated, try moving everything into explicit new's. mike -- You received this message because you

[android-developers] Re: Variable values just get lost!??!?

2010-02-08 Thread Florian Lettner
Mhm, I guess this could be the problem. I will check it. Otherwise I will use a shared property which will finally solve this issue. On 8 Feb., 21:24, Mike Collins mike.d.coll...@gmail.com wrote: Some thoughts, Is your service delcared remote in the manifest?  If so you do know how to debug

[android-developers] Re: Variable values just get lost!??!?

2010-02-06 Thread Streets Of Boston
I don't if it was a typo or not, but shouldn't this code be like this?: public static ServerConnection getInstance() { if(m_connection == null) m_connection = new ServerConnection(); return m_connection; } (added 'm_connection = ' to the second line of the function's

[android-developers] Re: Variable values just get lost!??!?

2010-02-06 Thread Bob Kerns
In addition to the comment/correction by Streets of Boston... It's unclear from your description just where you're storing your non- static variables. The right way would appear to be in your ServerConnection instance, since that's the static singleton. Your activity will have a much shorter