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:com.koushikdutta.superuser.MainActivity.java

void doSystemInstall() {
    final ProgressDialog dlg = new ProgressDialog(this);
    dlg.setTitle(R.string.installing);/*from w ww. ja  va  2s. com*/
    dlg.setMessage(getString(R.string.installing_superuser));
    dlg.setIndeterminate(true);
    dlg.show();
    new Thread() {
        public void run() {
            boolean _error = false;
            try {
                final File su = extractSu();
                final String command = "mount -orw,remount /system\n" + "rm /system/xbin/su\n"
                        + "rm /system/bin/su\n" + "rm /system/app/Supersu.*\n" + "rm /system/app/superuser.*\n"
                        + "rm /system/app/supersu.*\n" + "rm /system/app/SuperUser.*\n"
                        + "rm /system/app/SuperSU.*\n"
                        + String.format("cat %s > /system/xbin/su\n", su.getAbsolutePath())
                        + "chmod 6755 /system/xbin/su\n" + "ln -s /system/xbin/su /system/bin/su\n"
                        + "mount -oro,remount /system\n" + "sync\n";
                Process p = Runtime.getRuntime().exec("su");
                p.getOutputStream().write(command.getBytes());
                p.getOutputStream().close();
                if (p.waitFor() != 0)
                    throw new Exception("non zero result");
                SuHelper.checkSu(MainActivity.this);
            } catch (Exception ex) {
                _error = true;
                Log.e("Superuser", "error upgrading", ex);
            }
            dlg.dismiss();
            final boolean error = _error;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                    builder.setPositiveButton(android.R.string.ok, null);
                    builder.setTitle(R.string.install);

                    if (error) {
                        builder.setMessage(R.string.install_error);
                    } else {
                        builder.setMessage(R.string.install_success);
                    }
                    builder.create().show();
                }
            });
        };
    }.start();
}

From source file:com.oonusave.coupon.MyMapStore.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;//  w w  w .java 2 s .  co m
    switch (id) {
    case PRO_DIALOG:
        ProgressDialog dialog1 = new ProgressDialog(this);
        dialog1.setMessage(AlertMsgUtil.getLoadingMessageText());
        dialog1.setIndeterminate(true);
        dialog1.setCancelable(true);
        dialog = dialog1;
    }
    return dialog;
}

From source file:com.owncloud.android.ui.activity.FileDetailActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;// www .ja v  a 2  s  .c  o m
    switch (id) {
    case DIALOG_SHORT_WAIT: {
        ProgressDialog working_dialog = new ProgressDialog(this);
        working_dialog.setMessage(getResources().getString(R.string.wait_a_moment));
        working_dialog.setIndeterminate(true);
        working_dialog.setCancelable(false);
        dialog = working_dialog;
        break;
    }
    default:
        dialog = null;
    }
    return dialog;
}

From source file:com.example.Bama.chat.chatuidemo.activity.ContactlistFragment.java

/**
 * ?/*from w w w . ja va2s.c o  m*/
 *
 * @param
 */
public void deleteContact(final User tobeDeleteUser) {
    String st1 = getResources().getString(R.string.deleting);
    final String st2 = getResources().getString(R.string.Delete_failed);
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage(st1);
    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());
                HCApplication.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(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });

            }

        }
    }).start();

}

From source file:com.xiaoyu.DoctorHelp.chat.chatuidemo.activity.ContactlistFragment.java

/**
 * ?//from   www  .  ja v  a2 s.  com
 *
 * @param
 */
public void deleteContact(final User tobeDeleteUser) {
    String st1 = getResources().getString(R.string.deleting);
    final String st2 = getResources().getString(R.string.Delete_failed);
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage(st1);
    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());
                HCApplicaton.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(), st2 + e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });

            }

        }
    }).start();

}

From source file:com.ccxt.whl.activity.RegisterActivity.java

/**
 * //from w  w  w.  ja  v a 2  s.  co m
 * 
 * @param view
 */
public void register(View view) {
    final String email = emailEditText.getText().toString().trim();
    final String username = userNameEditText.getText().toString().trim();
    final String pwd = passwordEditText.getText().toString().trim();
    String confirm_pwd = confirmPwdEditText.getText().toString().trim();
    if (TextUtils.isEmpty(email)) {
        Toast.makeText(this, "??", Toast.LENGTH_SHORT).show();
        emailEditText.requestFocus();
        return;
    } else 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;
    } else if (sex == null) {
        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();
        RequestParams params = new RequestParams();
        params.add("tel_email", email);
        params.add("nickname", username);
        params.add("pwd", MD5.MD5Hash(pwd));
        params.add("sex", sex);
        params.add("uid", uid);

        HttpRestClient.get(Constant.REGISTER_URL, params, new BaseJsonHttpResponseHandler() {

            @Override
            public void onSuccess(int statusCode, Header[] headers, String rawJsonResponse, Object response) {
                Log.d("login_res_json" + rawJsonResponse);

                if (CommonUtils.isNullOrEmpty(rawJsonResponse)) {
                    Toast.makeText(getApplicationContext(), "?,?", 0)
                            .show();
                    return;
                }
                Map<String, Object> lm = JsonToMapList.getMap(rawJsonResponse);

                if (lm.get("status").toString() != null && lm.get("status").toString().equals("yes")) {
                    Map<String, Object> result = JsonToMapList.getMap(lm.get("result").toString());
                    String resultStr = "status:" + lm.get("status") + "\n" + "message:" + lm.get("message")
                            + "\n" + "result:" + lm.get("result") + "\n" + "user:" + result.get("user") + "\n"
                            + "pwd:" + result.get("pwd") + "\n";

                    Log.d("login_res_obj" + resultStr);
                    pd.dismiss();

                    //Map<String, Object> result = JsonToMapList.getMap(lm.get("result").toString());
                    //reg(result.get("user").toString(),result.get("pwd").toString());
                    Toast.makeText(getApplicationContext(), lm.get("message").toString(), 0).show();
                } else {
                    Toast.makeText(getApplicationContext(), lm.get("message").toString(), 0).show();
                    pd.dismiss();
                }

            }

            @Override
            public void onFailure(int statusCode, Header[] headers, Throwable throwable, String rawJsonData,
                    Object errorResponse) {
                // TODO Auto-generated method stub
                Toast.makeText(getApplicationContext(), "?,?", 0).show();
            }

            @Override
            protected Object parseResponse(String rawJsonData, boolean isFailure) throws Throwable {
                // TODO Auto-generated method stub
                return null;
            }

        });

    }
}

From source file:com.pixmob.r2droid.SelectAccountActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    if (AUTH_PENDING_DIALOG == id) {
        return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(R.string.auth_pending)
                .setIcon(R.drawable.alert_dialog_icon).create();
    }// w w  w  .j  a  v a  2  s.  c o m
    if (AUTH_ERROR_DIALOG == id) {
        return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(R.string.auth_failed_error)
                .setIcon(R.drawable.alert_dialog_icon).create();
    }
    if (NETWORK_ERROR_DIALOG == id) {
        return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(R.string.network_error)
                .setIcon(R.drawable.alert_dialog_icon).create();
    }
    if (PROGRESS_DIALOG == id) {
        final ProgressDialog d = new ProgressDialog(this);
        d.setTitle(R.string.please_wait);
        d.setMessage(getString(R.string.checking_account));
        d.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                accountVerifier.cancel(true);
                accountVerifier = null;
            }
        });
        return d;
    }
    return super.onCreateDialog(id);
}

From source file:la.zmkm.agent.activity.ContactlistFragment.java

/**
 * ?/*ww  w. j  a  va2s . c  o m*/
 * 
 * @param toDeleteUser
 */
public void deleteContact(final User tobeDeleteUser) {
    String st1 = getResources().getString(R.string.deleting);
    final String st2 = getResources().getString(R.string.Delete_failed);
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage(st1);
    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(), st2 + e.getMessage(), 1).show();
                    }
                });

            }

        }
    }).start();

}

From source file:com.rastating.droidbeard.MainActivity.java

private void restartSickbeard(boolean prompt) {
    if (prompt) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Confirmation").setMessage("Are you sure you want to restart SickBeard?")
                .setCancelable(true).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override//  w  w  w .ja  va  2  s .c o m
                    public void onClick(DialogInterface dialogInterface, int i) {
                        restartSickbeard(false);
                    }
                }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                    }
                }).create().show();
    } else {
        final ProgressDialog dialog = new ProgressDialog(this);
        dialog.setTitle("Restarting");
        dialog.setMessage("Please wait...");
        dialog.setCancelable(false);
        dialog.setIndeterminate(true);
        dialog.show();

        RestartTask task = new RestartTask(this);
        task.addResponseListener(new ApiResponseListener<Boolean>() {
            @Override
            public void onApiRequestFinished(SickbeardAsyncTask sender, Boolean result) {
                dialog.dismiss();
            }
        });
        task.start();
    }
}

From source file:org.mythdroid.activities.MDActivity.java

@Override
public Dialog onCreateDialog(int id) {

    switch (id) {

    case FRONTEND_CHOOSER:
        final Dialog d = createFrontendDialog();
        d.setOnDismissListener(dismissListener);
        d.setOnCancelListener(cancelListener);
        return d;

    case DIALOG_LOAD:
        final ProgressDialog prog = new ProgressDialog(this);
        prog.setIndeterminate(true);//from   ww w.  j ava 2 s .  c  om
        prog.setMessage(getResources().getText(R.string.loading));
        prog.setCanceledOnTouchOutside(false);
        prog.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface arg0) {
                finish();
            }
        });
        return prog;

    }

    return null;

}