Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UpdateProfileAsync extends AsyncTask<Void, Void, Object> {
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- showDialog();
- }
- @Override
- protected Object doInBackground(Void... voids) {
- HashMap data = new HashMap();
- if (userData != null) {
- client = new LegitWampClient(userData.getUri(),
- userData.getRealm(), userData.getEmail(), userData.getPassword());
- Map<String, Object> u = client.getLoginUser();
- if (u != null) {
- u.put(WampApiFieldKeys.U_FIRST, firstName);
- u.put(WampApiFieldKeys.U_LAST, lastName);
- //setup address object
- Map<String, Object> m = new HashMap<>();
- m.put(WampApiFieldKeys.UA_TYPE, "home");
- m.put(WampApiFieldKeys.UA_COUNTRY, "US");
- m.put(WampApiFieldKeys.UA_STATE, state);
- m.put(WampApiFieldKeys.UA_CITY, city);
- // create new address list
- List<Map<String, Object>> nadds = new ArrayList<>();
- nadds.add(m);
- // set address list to user object
- u.put(WampApiFieldKeys.U_ADDRESS_LIST, nadds);
- // u.put(WampApiFieldKeys.U_PROFILE_IMG, session.getProvaProfileImages());
- // u.put(WampApiFieldKeys.U_COVER_IMG, session.getProvaCoverImages());
- Map<String, Object> userObject = client.updateUser(u);
- try {
- return userObject;
- } catch (Exception ie) {
- new Thread() {
- public void run() {
- EditProfileActivity.this.runOnUiThread(new Runnable() {
- public void run() {
- noExecptionCaught = false;
- //Do your UI operations like dialog opening or Toast here
- ProvaUtile.showOrangeToast("Please try Again", EditProfileActivity.this, false);
- }
- });
- }
- }.start();
- }
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement