public void Updatefbotp() { Mobile = Usermobile.getText().toString(); otp = Faceotp.getText().toString(); ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("firstName", Fname)); nameValuePairs.add(new BasicNameValuePair("lastName", Lname)); nameValuePairs.add(new BasicNameValuePair("email", Email)); nameValuePairs.add(new BasicNameValuePair("mobile", Mobile)); try { String Facebookmobile = "" + Url + "/faceSignUp/?"; // String Facebookmobile = "http://jaidevcoolcab.cabsaas.in/sandbox/index/faceSignUp/?"; // String APIKEY="S2AORU-KOXBNK-161JB3-S5HFAV-CI5O47"; // String APIKEY = "PVU1ZE-ZE4TPC-5IXWAJ-P2E6ZE-QONPEC-4IUGWD"; String uri = Uri.parse(Facebookmobile) .buildUpon() .appendQueryParameter("firstName", Fname) .appendQueryParameter("lastName", Lname) .appendQueryParameter("email", Email) .appendQueryParameter("mobile", Mobile) .appendQueryParameter("token", token) .appendQueryParameter("otp", otp) .appendQueryParameter("ApiKey", APIKEY) .appendQueryParameter("UserID", "1212") .appendQueryParameter("UserIPAddress", IPAddress) .appendQueryParameter("UserAgent", "androidApp") .appendQueryParameter("responsetype", "2") .build() .toString(); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(uri); Log.i("uri", uri); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); ResponseHandler<String> responseHandler = new BasicResponseHandler(); final String response = httpclient.execute(httppost, responseHandler); // Toast.makeText(this, "" + response, Toast.LENGTH_LONG).show(); Log.i("response", "" + response); runOnUiThread( new Runnable() { public void run() { dialog.dismiss(); } }); /* JSONArray json = new JSONArray(response); Log.i("json",""+json); JSONObject jsonObject = json.getJSONObject(0); final String LoginStatus =jsonObject.getString(Tag_Sign); Log.i("LoginStatus", LoginStatus);*/ final String Str = "1"; JSONArray json = new JSONArray(response); Log.i("json", "" + json); JSONObject jsonObject = json.getJSONObject(0); String str = "4"; final String LoginStatus = jsonObject.getString(Tag_Subuserid); Log.i("LoginStatus", LoginStatus); if (LoginStatus.compareTo(str) == 0) { Log.i("str", str); session.createUserLoginSession(Email, token); uId = jsonObject.getString(Tag_uid); Cashwalletbalance = jsonObject.getInt(TagprefernceBalance); Useremail = jsonObject.getString(Tagemail); mobile = jsonObject.getString(Tagmobile); fname = jsonObject.getString(Tagname); // fname = jsonObject.getString(Tagname); lname = jsonObject.getString(TagLname); Log.i("fname", fname); editor = sharedpreferences.edit(); editor.putString(Email, Useremail); editor.putString(Tag_uid, uId); editor.putString(Tagname, fname); editor.putString(TagLname, lname); editor.putInt(TagprefernceBalance, Cashwalletbalance); editor.putString(Tagemail, Useremail); editor.putString(Tagmobile, mobile); editor.apply(); } runOnUiThread( new Runnable() { @Override public void run() { if (LoginStatus.equals("4")) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(MobileActivity.this); alertDialog.setTitle("Confirmed"); // alertDialog.setMessage("Please Check your Mail For Login "); alertDialog.setPositiveButton( "ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Resetlayout.setVisibility(View.VISIBLE); Intent in = new Intent(MobileActivity.this, BaseNavigation.class); startActivity(in); finish(); } }); alertDialog.show(); } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(MobileActivity.this); alertDialog.setTitle("Invalid"); alertDialog.setMessage("Invalid OTP"); // alertDialog.setIcon(R.drawable.fail); alertDialog.setPositiveButton( "ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {} }); alertDialog.show(); } } }); } catch (Exception e) { Log.e("Fail 1", e.toString()); // Toast.makeText(getApplicationContext(), "Invalid IP Address", Toast.LENGTH_LONG).show(); } }