I wrote some code that activity starts a service to get some text from URL, after the service done I want to get this parameters to activity back.
My code looks like this:
public class splash extends AsyncTask<String, Void, String> {
private Context context;
private ProgressDialog Dialog;
protected config app;
public splash(Context context){
this.context=context;
Dialog = new ProgressDialog(context);
}
protected String doInBackground(String... params) {
//starts service number activite
Intent serviceIntent = new Intent();
serviceIntent.setAction("services.conServise");
context.startService(serviceIntent);
I dont want to use global parameters and not a singleton
If you want to call the
Servicefrom yourActivity, what you want is a bound service. It will bind your service to a variable, and you will be able to use that in theActivity.