I am using a Service to connect to a network using a AsyncTask. I want to show a ProgressDialog till the app is connected to the network. But how can I do this?
My S
So a service is NOT the UI you have to use the observer pattern. Your activity have to register a listener in the service so that the service can inform the activity for special events (like start loading or finish loading).
You have to add following intercae into your service class:
public interface serviceObserver {
public void startLoading();
public void stopLoading();
}
Your activity has to implement serviceObserver. Your service has to store a instance from serviceObserver which is created in the activity. If your service is running without your activity i recommend to use broadcast receiver for communication.