I am using the service to connect to the network using AsyncTask. I want to show ProgressDialog until the application is connected to the network. But how can I do this?
My service looks like this:
package de.bertrandt.bertrandtknx; import tuwien.auto.calimero.link.KNXNetworkLinkIP; import tuwien.auto.calimero.process.ProcessCommunicator; import de.bertrandt.bertrandtknx.Controls.OnOff; import android.app.ProgressDialog; import android.app.Service; import android.content.Intent; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.os.IBinder; import android.widget.Toast; public class ConnectionService extends Service { public static KNXNetworkLinkIP m_netLinkIp = null; private static ProcessCommunicator m_pc = null; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() {
Of course, this code creates problems, how can I get the activity context that starts the Service?
The dialog should be displayed in the action that launches the Service until the application is connected.
android android-asynctask android-service progressdialog
Mr. Mojo
source share