Advertisement
Guest User

Untitled

a guest
Nov 21st, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. protected JSONObject doInBackground(String... params) {
  2.     try {
  3.  
  4.         //Url
  5.         api = ServiceUrl.getBaseUrl() + ServiceUrl.getLoginUrl();
  6.         //build JsonObject
  7.         jsonParams = new JSONObject();
  8.         String userName = this.muserName; // params[0] is username
  9.         String password = this.mpassword; // params[1] is password
  10.         jsonParams.put("user_name", userName);
  11.         jsonParams.put("password", password);
  12.  
  13.         ServerRequest request = new ServerRequest(api, jsonParams);
  14.         return request.sendRequest();
  15.  
  16.     } catch (UnknownHostException e) {
  17.         progressDialog.dismiss();
  18.         activity.showAlert("Please check internet connection.");
  19.         return Excpetion2JSON.getJSON(e); // returns exception here
  20.     }catch (JSONException je) {
  21.         progressDialog.dismiss();
  22.         activity.showAlert("Please check internet connection.");
  23.         return Excpetion2JSON.getJSON(je); // returns exception here
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement