Yes , its right . U can as many times as u want to call . But a small modification can be done , instend of call 4 AsyncTask , u can one AsyncTask by making its generic in flow .
`
public class GetDataFromNetwork extends AsyncTask<Void,String,Object> {private String ipAddress;
private String webService;
private String nameSpace;
private String methodName;
private Context context;
private ProgressDialog progressDialog;
private SoapObject request;
private GetDataCallBack callBack;
/**
* Set default progress Bar properties. Internal function called from setConfig
*
* @param progressBarStyle : Progress Dialog style (spinner or horizontal)
* @param message : Message to be displayed on progressBar
*/
protected void setProgresDialogProperties(int progressBarStyle,
String message) {
progressDialog = new ProgressDialog(context);
progressDialog.setProgress(0);
progressDialog.setMax(100);
progressDialog.setProgressStyle(progressBarStyle);
progressDialog.setMessage(message);
}
public GetDataFromNetwork(Context context,int progressBarStyle,String message ,GetDataCallBack callBack) {
this.callBack=callBack;
this.context=context;
setProgresDialogProperties(progressBarStyle, message);
}
/**
* Used for setting up the location and config of remote location/webservice
* @param ipAddress : IP of webservice
* @param webService : Name of webservice
* @param nameSpace : NameSpace of webService
* @param methodName :Name of function of the particular webservice
*/
public void setConfig(String ipAddress,String webService,String nameSpace,String methodName){
this.ipAddress=ipAddress;
this.webService=webService;
this.nameSpace=nameSpace;
this.methodName=methodName;
}
/**
* Set parameter in SoapObject
* @param requestParamater : Map of request
*/
@SuppressWarnings("rawtypes")
public void sendData(HashMap<String, Object> requestParamater) {
}
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog.show();
}
@Override
protected Object doInBackground(Void... params) {
return result;
}
@Override
protected void onPostExecute(Object result) {
super.onPostExecute(result);
progressDialog.dismiss();
}`
Now u can call this class when ever u want to interact with ur server.