Hey guys,
I seriously need help with a quite strange problem. I created a client
which communicates with a server. Therefore, I have three classes. An
activity providing a nice dialog to configure some data, a background
service which checks the connection status periodically and a server
class which handles the socket connection. Originally, the background
service owned a server connection object but because I could not
manage to provide data from the activity to the service, I decided to
create the server connection class as singleton.
The user is now able to change data in the activity (IP, Port,
Username, Password) which shall be transmitted to the server object,
if the save button is pressed. The data is read correctly, the
activity calls the setter of the server class and the logcat also says
that this data is correctly applied to the variable that stores the
data in the server class. However, if I try to start the socket
connection still the old values are stored in my variables although
they've been overwritten before. What I am doing wrong, or how can I
fix this?
My singleton looks like this.
static ServerConnection m_connection;
public static ServerConnection getInstance() {
if(m_connection == null)
new ServerConnection();
return m_connection;
}
All getters/setters and other variables are non-static.
Best regards,
Florian
--
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