Web サービスを呼び出そうとしていますが、ボタンをクリックしても何も起こりません。Activtygroup を使用しています。子と親の両方のタイプのコンテキストを試しましたが、機能しません。WindowManagerBadTokenExceptionを示しています。
Webサービスを呼び出すコードは次のとおりです。
//GET USER WEBSERVICE
public void callUpdateUserInfo_WS() {
if (NetworkAvailablity.checkNetworkStatus(ProfileScreen.this)) {
// PREPARE URL
Constant.methodURL = "http://admin.tvdevphp.com/goalmachine/update_profile.php";
// PREPARE REQUEST PARAMETER
ArrayList<NameValuePair> requestParaList = new ArrayList<NameValuePair>();
requestParaList.add(new BasicNameValuePair("user_id", "1"));
requestParaList.add(new BasicNameValuePair("first_name", "Ricky"));
requestParaList.add(new BasicNameValuePair("age", "0"));
requestParaList.add(new BasicNameValuePair("age_visible", "Yes"));
requestParaList.add(new BasicNameValuePair("parental_status", "Yes"));
requestParaList.add(new BasicNameValuePair("parental_status_visible", "Yes"));
requestParaList.add(new BasicNameValuePair("marital_status", "Single"));
requestParaList.add(new BasicNameValuePair("marital_status_visible", "No"));
requestParaList.add(new BasicNameValuePair("short_bio", "Hard working"));
requestParaList.add(new BasicNameValuePair("short_bio_visible", "Yes"));
requestParaList.add(new BasicNameValuePair("country", "India"));
requestParaList.add(new BasicNameValuePair("country_visible", "Yes"));
requestParaList.add(new BasicNameValuePair("zipcode", "452001"));
requestParaList.add(new BasicNameValuePair("zipcode_visible", "Yes"));
requestParaList.add(new BasicNameValuePair("avatar", ""));
requestParaList.add(new BasicNameValuePair("latest_status_update", "In Indore India."));
requestParaList.add(new BasicNameValuePair("latest_status_update_visible", "Yes"));
requestParaList.add(new BasicNameValuePair("pain_scale", "50"));
requestParaList.add(new BasicNameValuePair("pain_scale_visible", "No"));
// CALL WEBSERVICE
WebServiceCommunicator.getInstance().registerForServerResponse(
(IServerResponse)this.getParent());
WebServiceCommunicator.getInstance().callGetAppWebService(
Constant.showDialog, this.getParent(),
Constant.methodURL, this.getParent(), Constant.PID_UPDATE_USER_INFO,
false, requestParaList);
} else {
Constant.showAlertDialog(Constant.errorTitle,
Constant.MSG_CHECK_INTERNET_SETTING, this.getParent(),
false);
}
}
これはWebサービスのものです:
public void callGetAppWebService(final Boolean showProgressBar,
final Context childContext, final String url,
final Context context, final int processid,
final boolean isFinishForFailResponse,
final ArrayList<NameValuePair> requestParaList) {
if (_progressDialog != null && _progressDialog.isShowing()) {
_progressDialog.cancel();
}
if (showProgressBar) {
_progressDialog = ProgressDialog
.show(context, "", "Please wait...");
}
_context = childContext;
_isFinishForFailResponse = isFinishForFailResponse;
new Thread(new Runnable() {
public void run() {
Looper.prepare();
try {
if (NetworkAvailablity.checkNetworkStatus(context)) {
String jsonResponse = WebService.postData(url,
requestParaList);
if (jsonResponse != null && jsonResponse.length() != 0) {
strResponse = jsonResponse;
Log.v("response", strResponse);
}
} else {
}
} catch (Exception e) {
// DebugLog.LOGE("Exception from callWebService():" +
// e.toString());
}
if (showProgressBar)
_progressDialog.cancel();
handleResponse(strResponse, processid);
}
}).start();
}