Example usage for android.app ProgressDialog setMessage

List of usage examples for android.app ProgressDialog setMessage

Introduction

In this page you can find the example usage for android.app ProgressDialog setMessage.

Prototype

@Override
    public void setMessage(CharSequence message) 

Source Link

Usage

From source file:fr.eoit.activity.LocationManagementActivity.java

@Override
protected void onResume() {
    super.onResume();

    if (!standingUpdated) {
        ProgressDialog waitDialog = new ProgressDialog(this);
        waitDialog.setCancelable(true);//from   w ww.  ja  v a2  s  .c o m
        waitDialog.setMessage(getString(R.string.retreiving_standing));
        waitDialog.show();

        new UpdateStandingAsyncTask(waitDialog).execute(this);
        standingUpdated = true;
    }
}

From source file:com.ntsync.android.sync.activities.RegistrateProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getText(R.string.register_activity_progress));
    dialog.setIndeterminate(true);//from   w  w w  . j  a v  a 2 s. com
    return dialog;
}

From source file:im.afterclass.android.activity.RegisterActivity.java

/**
 * /*from  w w w. jav  a2s  .  com*/
 * @param view
 */
public void register(View view) {
    final String username = userNameEditText.getText().toString().trim();
    final String pwd = passwordEditText.getText().toString().trim();
    String confirm_pwd = confirmPwdEditText.getText().toString().trim();
    if (TextUtils.isEmpty(username)) {
        Toast.makeText(this, "????", Toast.LENGTH_SHORT).show();
        userNameEditText.requestFocus();
        return;
    } else if (TextUtils.isEmpty(pwd)) {
        Toast.makeText(this, "???", Toast.LENGTH_SHORT).show();
        passwordEditText.requestFocus();
        return;
    } else if (TextUtils.isEmpty(confirm_pwd)) {
        Toast.makeText(this, "???", Toast.LENGTH_SHORT).show();
        confirmPwdEditText.requestFocus();
        return;
    } else if (!pwd.equals(confirm_pwd)) {
        Toast.makeText(this, "????", Toast.LENGTH_SHORT).show();
        return;
    }

    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
        final ProgressDialog pd = new ProgressDialog(this);
        pd.setMessage("...");
        pd.show();
        new Thread(new Runnable() {
            public void run() {
                try {
                    //sdk
                    EMChatManager.getInstance().createAccountOnServer(username, pwd);
                    runOnUiThread(new Runnable() {
                        public void run() {
                            if (!RegisterActivity.this.isFinishing())
                                pd.dismiss();
                            //???
                            DemoApplication.getInstance().setUserName(username);
                            Toast.makeText(getApplicationContext(), "?", 0).show();
                            newRegister();
                            finish();
                        }
                    });
                } catch (final Exception e) {
                    runOnUiThread(new Runnable() {
                        public void run() {
                            if (!RegisterActivity.this.isFinishing())
                                pd.dismiss();
                            if (e != null && e.getMessage() != null) {
                                String errorMsg = e.getMessage();
                                if (errorMsg.indexOf("EMNetworkUnconnectedException") != -1) {
                                    Toast.makeText(getApplicationContext(), "?",
                                            0).show();
                                } else if (errorMsg.indexOf("conflict") != -1) {
                                    Toast.makeText(getApplicationContext(), "?", 0).show();
                                } else {
                                    Toast.makeText(getApplicationContext(), ": " + e.getMessage(),
                                            1).show();
                                }

                            } else {
                                Toast.makeText(getApplicationContext(), ": ", 1).show();

                            }
                        }
                    });
                }
            }
        }).start();

    }
}

From source file:com.ntsync.android.sync.activities.LoginProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getText(R.string.ui_activity_authenticating));
    dialog.setIndeterminate(true);/* w  ww . j a  v  a2s . co  m*/
    return dialog;
}

From source file:com.easemob.chatuidemo.activity.NewGroupActivity.java

public void setGroup(final String groupName, final String groupIntroduce, final String open,
        final String number, final String allow_invite) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage("");
    pd.setCanceledOnTouchOutside(false);
    pd.show();//from   ww w.j  a v  a  2s.  com
    Log.i("FriMsg", groupName + groupIntroduce + open + number + allow_invite);
    RequestQueue requestQueue = Volley.newRequestQueue(this);

    requestQueue.start();

    requestQueue.add(new AutoLoginRequest(this, Request.Method.POST, Model.PathLoad,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    Log.i("FriMsg", response.toString());
                    try {
                        if (response.getString("status").equals("0")) {
                            Toast.makeText(NewGroupActivity.this, "?", 0).show();
                            NewGroupActivity.this.finish();
                        }

                    } catch (Exception e) {
                        Log.e("Activity_boshu_FriMsg", "?");
                    }
                    pd.dismiss();

                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.i("FriMsg", error.getMessage());
                    pd.dismiss();

                }
            }) {
        @Override
        protected void setParams(Map<String, String> params) {
            params.put("sys", "msg");
            params.put("ctrl", "msger");
            params.put("action", "crt_group");
            params.put("group_name", groupName);
            params.put("introduce", groupIntroduce);
            params.put("maxusers", "5000");
            params.put("public", open);
            params.put("approval", "1");
            params.put("members", number);
            params.put("allow_invite", allow_invite);

        }
    });
}

From source file:com.aibasis.parent.ui.entrance.RegisterActivity.java

/**
 * //from   w  ww . ja  v  a2  s  . c  o m
 * 
 * @param view
 */
public void register(View view) {
    final String username = userNameEditText.getText().toString().trim();
    final String pwd = passwordEditText.getText().toString().trim();
    String confirm_pwd = confirmPwdEditText.getText().toString().trim();
    if (TextUtils.isEmpty(username)) {
        Toast.makeText(this, getResources().getString(R.string.User_name_cannot_be_empty), Toast.LENGTH_SHORT)
                .show();
        userNameEditText.requestFocus();
        return;
    } else if (TextUtils.isEmpty(pwd)) {
        Toast.makeText(this, getResources().getString(R.string.Password_cannot_be_empty), Toast.LENGTH_SHORT)
                .show();
        passwordEditText.requestFocus();
        return;
    } else if (TextUtils.isEmpty(confirm_pwd)) {
        Toast.makeText(this, getResources().getString(R.string.Confirm_password_cannot_be_empty),
                Toast.LENGTH_SHORT).show();
        confirmPwdEditText.requestFocus();
        return;
    } else if (!pwd.equals(confirm_pwd)) {
        Toast.makeText(this, getResources().getString(R.string.Two_input_password), Toast.LENGTH_SHORT).show();
        return;
    }

    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
        final ProgressDialog pd = new ProgressDialog(this);
        pd.setMessage(getResources().getString(R.string.Is_the_registered));
        pd.show();

        new Thread(new Runnable() {
            public void run() {
                //               try {
                //                  // sdk
                //                  EMChatManager.getInstance().createAccountOnServer(username, pwd);
                //                  runOnUiThread(new Runnable() {
                //                     public void run() {
                //                        if (!RegisterActivity.this.isFinishing())
                //                           pd.dismiss();
                //                        // ???
                //                        DemoApplication.getInstance().setUserName(username);
                //                        Toast.makeText(getApplicationContext(), getResources().getString(R.string.Registered_successfully), 0).show();
                //                        finish();
                //                     }
                //                  });
                //               } catch (final EaseMobException e) {
                //                  runOnUiThread(new Runnable() {
                //                     public void run() {
                //                        if (!RegisterActivity.this.isFinishing())
                //                           pd.dismiss();
                //                        int errorCode=e.getErrorCode();
                //                        if(errorCode==EMError.NONETWORK_ERROR){
                //                           Toast.makeText(getApplicationContext(), getResources().getString(R.string.network_anomalies), Toast.LENGTH_SHORT).show();
                //                        }else if(errorCode == EMError.USER_ALREADY_EXISTS){
                //                           Toast.makeText(getApplicationContext(), getResources().getString(R.string.User_already_exists), Toast.LENGTH_SHORT).show();
                //                        }else if(errorCode == EMError.UNAUTHORIZED){
                //                           Toast.makeText(getApplicationContext(), getResources().getString(R.string.registration_failed_without_permission), Toast.LENGTH_SHORT).show();
                //                        }else if(errorCode == EMError.ILLEGAL_USER_NAME){
                //                            Toast.makeText(getApplicationContext(), getResources().getString(R.string.illegal_user_name),Toast.LENGTH_SHORT).show();
                //                        }else{
                //                           Toast.makeText(getApplicationContext(), getResources().getString(R.string.Registration_failed) + e.getMessage(), Toast.LENGTH_SHORT).show();
                //                        }
                //                     }
                //                  });
                //               }
                accountAPI.register(username, pwd, new RequestListener() {
                    @Override
                    public void onComplete(String result) {
                        if (!RegisterActivity.this.isFinishing())
                            pd.dismiss();
                        try {
                            RegisterResult registerResult = RegisterResult.parse(result);
                            if (RegisterResult.SUCCESS.equals(registerResult.getResult())) {
                                DemoApplication.getInstance().setParentId(registerResult.getParentId());
                                DemoApplication.getInstance().setEaseId(registerResult.getEaseId());
                                DemoApplication.getInstance().setEasePassword(registerResult.getEasePassword());

                                SharePreferenceUtil sharePreferenceUtil = new SharePreferenceUtil(
                                        RegisterActivity.this);
                                sharePreferenceUtil.setParentId(registerResult.getParentId());
                            } else if (RegisterResult.USERNAME_EXISTS.equals(registerResult.getResult())) {
                                Toast.makeText(RegisterActivity.this,
                                        getResources().getString(R.string.User_already_exists),
                                        Toast.LENGTH_SHORT).show();
                            }

                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        finish();
                    }

                    @Override
                    public void onAPIException(APIException exception) {
                        Log.e("jijun", exception.toString());
                    }
                });

            }
        }).start();
    }
}

From source file:org.hedgewars.hedgeroid.ConnectingDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setIndeterminate(true);//w  w  w.  java  2 s  .  c o  m
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setTitle(R.string.dialog_connecting_title);
    dialog.setMessage(getString(R.string.dialog_connecting_message));
    return dialog;
}

From source file:net.kourlas.voipms_sms.gcm.Gcm.java

/**
 * Registers for Google Cloud Messaging. Sends the registration token to the application servers.
 *
 * @param activity     The activity that initiated the registration.
 * @param showFeedback If true, shows a dialog at the end of the registration process indicating the success or
 *                     failure of the process.
 * @param force        If true, retrieves a new registration token even if one is already stored.
 *///from  www  .j  ava2 s. co  m
public void registerForGcm(final Activity activity, final boolean showFeedback, boolean force) {
    if (!preferences.getNotificationsEnabled()) {
        return;
    }
    if (preferences.getDid().equals("")) {
        // Do not show an error; this method should never be called unless a DID is set
        return;
    }
    if (!checkPlayServices(activity, showFeedback)) {
        return;
    }

    final ProgressDialog progressDialog = new ProgressDialog(activity);
    if (showFeedback) {
        progressDialog.setMessage(applicationContext.getString(R.string.notifications_gcm_progress));
        progressDialog.setCancelable(false);
        progressDialog.show();
    }

    final InstanceID instanceIdObj = InstanceID.getInstance(applicationContext);
    final String instanceId = instanceIdObj.getId();
    if (preferences.getGcmToken().equals("") || !instanceId.equals(preferences.getGcmInstanceId()) || force) {
        new AsyncTask<Boolean, Void, Boolean>() {
            @Override
            protected Boolean doInBackground(Boolean... params) {
                try {
                    String token = instanceIdObj.getToken(
                            applicationContext.getString(R.string.notifications_gcm_sender_id),
                            GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);

                    String registrationBackendUrl = "https://voipmssms-kourlas.rhcloud.com/register?" + "did="
                            + URLEncoder.encode(preferences.getDid(), "UTF-8") + "&" + "reg_id="
                            + URLEncoder.encode(token, "UTF-8");
                    JSONObject result = Utils.getJson(registrationBackendUrl);
                    String status = result.optString("status");
                    if (status == null || !status.equals("success")) {
                        return false;
                    }

                    preferences.setGcmInstanceId(instanceId);
                    preferences.setGcmToken(token);

                    return true;
                } catch (Exception ex) {
                    return false;
                }
            }

            @Override
            protected void onPostExecute(Boolean success) {
                if (showFeedback) {
                    progressDialog.hide();
                    if (!success) {
                        Utils.showInfoDialog(activity,
                                applicationContext.getResources().getString(R.string.notifications_gcm_fail));
                    } else {
                        Utils.showInfoDialog(activity, applicationContext.getResources()
                                .getString(R.string.notifications_gcm_success));
                    }
                }
            }
        }.execute();
    } else if (showFeedback) {
        Utils.showInfoDialog(activity,
                applicationContext.getResources().getString(R.string.notifications_gcm_success));
    }
}

From source file:im.afterclass.android.fragment.ContactlistFragment.java

/**
 * ?/*ww  w  . j  av a2  s .  c  o  m*/
 * @param toDeleteUser
 */
public void deleteContact(final User tobeDeleteUser) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("...");
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername());
                //db?
                UserDao dao = new UserDao(getActivity());
                dao.deleteContact(tobeDeleteUser.getUsername());
                DemoApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername());
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        adapter.remove(tobeDeleteUser);
                        adapter.notifyDataSetChanged();

                    }
                });
            } catch (final Exception e) {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), ": " + e.getMessage(), Toast.LENGTH_SHORT)
                                .show();
                    }
                });

            }

        }
    }).start();

}

From source file:com.ysls.imhere.fragment.ContactlistFragment.java

/**
 * ?//from   ww w. j  av  a 2s  . c o  m
 * 
 * @param toDeleteUser
 */
public void deleteContact(final User tobeDeleteUser) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("...");
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername());
                // db?
                UserDao dao = new UserDao(getActivity());
                dao.deleteContact(tobeDeleteUser.getUsername());
                MyApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername());
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        adapter.remove(tobeDeleteUser);
                        adapter.notifyDataSetChanged();

                    }
                });
            } catch (final Exception e) {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), ": " + e.getMessage(), 1).show();
                    }
                });

            }

        }
    }).start();

}