Last active
October 8, 2015 17:06
-
-
Save RajeshBatth/5453c51c8b3c88041591 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void publishProfileDetails(){ | |
final ProgressDialog updateProgress = ProgressDialog.show(this, "Updating Your Details", "Please Wait", false); | |
try{ | |
JSONObject params = new JSONObject(); | |
params.put("first_name",firstName.getText().toString()); | |
params.put("last_name",lastName.getText().toString()); | |
params.put("age",age.getText().toString()); | |
if(maleBtn.isChecked()) | |
params.put("gender","male"); | |
else | |
params.put("gender","female"); | |
JsonObjectRequest request = new JsonObjectRequest( | |
Request.Method.PUT, | |
String.format(ProjectURLs.USER_DETAILS, getUserID(Constants.PREFS_USER_ID)), | |
params, | |
new Response.Listener<JSONObject>() { | |
@Override | |
public void onResponse(JSONObject jsonObject) { | |
Log.d("oioLog", "updateUserProfile: " + jsonObject.toString()); | |
Toast.makeText(UserProfile.this, "Your details updated successfully",Toast.LENGTH_SHORT).show(); | |
tracker.sendEvent("ui_action", "UserProfile", "updated_user_details", 0L); | |
saveUserDetails(); | |
try { | |
if(isConvertDrawableToFile()){ | |
sendUserPic(); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
updateProgress.dismiss(); | |
} | |
}, | |
new Response.ErrorListener() { | |
@Override | |
public void onErrorResponse(VolleyError volleyError) { | |
Log.d("oioLog", "updateUserProfile: " + volleyError.toString()); | |
Toast.makeText(UserProfile.this, "Could not update, try again",Toast.LENGTH_SHORT).show(); | |
updateProgress.dismiss(); | |
} | |
} | |
); | |
Volley.newRequestQueue(this).add(request); | |
}catch (JSONException e){ | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment