Hi,
I would like to know if it's okay to do the follwing in a localservice:
public class theApp extends Application {
public static Handler m_msgHandler;
}
public class mainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
theApp.m_msgHandler = m_msgHandler;
::::
}
private final Handler m_msgHandler = new Handler() {
::::
}
// Create the service somewhere in activity...
};
// Localservice
public class CommunicationService extends Service {
// Create a thread when the service starts....
//
// ...and if the connection breaks for some reason
theApp.m_msgHandler.obtainMessage(theApp.WIFI_STATE_CHANGE, SMSWiFi.STATE_NONE, 0).sendToTarget();
}
It seems to work fine, but I'm not sure this is the proper way to send the message to the activity.
Thanks,
Nicholas