Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //loading all invitationa - memers with status INVITED
- class LoadAllInvitations extends AsyncTask<String, String, String> {
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- pDialog = new ProgressDialog(UserActivity.this);
- pDialog.setMessage("Loading invitations. Please wait...");
- pDialog.setIndeterminate(false);
- pDialog.setCancelable(false);
- pDialog.show();
- }
- protected String doInBackground(String... args) {
- // Building Parameters
- List<NameValuePair> params = new ArrayList<NameValuePair>();
- params.add(new BasicNameValuePair(TAG_USERID, String.valueOf(userID)));
- //getting JSON string from URL
- JSONObject json = jParser.makeHttpRequest(url_procedure_select_invitations_groups_with_names, "POST", params);
- Log.d("All Invitaions: ", json.toString());
- try {
- // Checking for SUCCESS TAG
- int success = json.getInt(TAG_SUCCESS);
- if (success == 1) {
- // users found Getting Array of membership
- memberships = json.getJSONArray(TAG_MEMBERSHIP);
- // looping through memberships with invitations status
- for (int i = 0; i < memberships.length(); i++) {
- JSONObject c = memberships.getJSONObject(i);
- String groupID = c.getString(TAG_GROUPID);
- String groupName = c.getString(TAG_GROUPNAME);
- HashMap<String, String> map = new HashMap<String, String>();
- map.put(TAG_GROUPID, groupID);
- map.put(TAG_GROUPNAME, groupName);
- invitationsList.add(map);
- }
- } else
- {
- Toast.makeText(getBaseContext(), "Error, can't load invitations", Toast.LENGTH_LONG).show();
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- return null;
- }
- protected void onPostExecute(String file_url) {
- pDialog.dismiss();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment