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.code.android.vibevault.FeaturedShowsScreen.java

/** Dialog creation method.
*
* Includes Thread bookkeeping to prevent not leaking Views on orientation changes.
*//*w w w  .  ja  v  a2s  .com*/
@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case VibeVault.RETRIEVING_DIALOG_ID:

        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setMessage("Retrieving Featured Shows...");
        return dialog;
    default:
        return super.onCreateDialog(id);
    }
}

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

public void reg(final String username, final String pwd) {
    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(pwd)) {
        final ProgressDialog pd = new ProgressDialog(this);
        pd.setMessage("...");
        pd.show();/*w ww.  j  av a2s  .c  o  m*/
        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();
                            RequestParams params = new RequestParams();
                            params.add("user", username);
                            if (DemoApplication.getInstance().getlastloc() != null) {
                                double Latitude = DemoApplication.getInstance().getlastloc().getLatitude();
                                double Longitude = DemoApplication.getInstance().getlastloc().getLongitude();
                                String adr = DemoApplication.getInstance().getlastloc().getAddrStr();
                                params.add("jiedao", adr);
                            }
                            HttpRestClient.get(Constant.REGISTER_URL_HUIZHI, params,
                                    new BaseJsonHttpResponseHandler() {

                                        @Override
                                        public void onSuccess(int statusCode, Header[] headers,
                                                String rawJsonResponse, Object response) {
                                            // TODO Auto-generated method stub
                                            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";

                                                Log.d("login_res_obj" + resultStr);

                                                pd.dismiss();
                                                // ???
                                                //                                 DemoApplication.getInstance().setUserName(username);
                                                DemoApplication.getInstance().setUser(username);
                                                Toast.makeText(getApplicationContext(), "?", 0)
                                                        .show();
                                                finish();
                                            } 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;
                                        }

                                    });

                        }
                    });
                } 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 if (errorMsg.indexOf("not support the capital letters") != -1) {
                                    Toast.makeText(getApplicationContext(), "??????",
                                            0).show();
                                } else {
                                    Toast.makeText(getApplicationContext(), ": " + e.getMessage(),
                                            1).show();
                                }

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

    }
}

From source file:ablgroup.daily2.authentification.AuthentificationFragment.java

private void createAccount(String email, String password) {
    Log.d(TAG, "createAccount:" + email);
    if (!validateForm()) {
        return;/*from  w w  w . jav a 2 s.  co m*/
    }

    final ProgressDialog pd = new ProgressDialog(AuthentificationFragment.this);
    pd.setMessage("loading");
    pd.show();

    // [START create_user_with_email]
    mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this,
            new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful());
                    if (!task.isSuccessful()) {
                        Toast.makeText(AuthentificationFragment.this, R.string.auth_failed, Toast.LENGTH_SHORT)
                                .show();
                    }
                    pd.hide();
                }
            });
    // [END create_user_with_email]
}

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

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getText(R.string.keypwd_activity_createpwd));
    dialog.setIndeterminate(true);/* ww  w . j av  a 2 s.  com*/

    return dialog;
}

From source file:com.grass.caishi.cc.frag.FriendsListFragment.java

/**
 * user???/*from   ww w  .  j  a v  a2 s  .co m*/
 */
private void moveToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("???...");
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                // ???
                EMContactManager.getInstance().addUserToBlackList(username, true);
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), "????", 0).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), "???", 0).show();
                    }
                });
            }
        }
    }).start();

}

From source file:com.easemob.chatuidemo.ui.setting.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);
    pd.setCanceledOnTouchOutside(false);
    pd.show();/*from ww  w.j av a2s.  c o  m*/
    DemoHelper.getInstance().logout(true, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.PostFragment.java

/**
 * onClick method for the post button. Extracts the textView information,
 * creates the threadComment object and posts it to the server.
 * //from w w  w.java 2 s.  c  om
 * @param view
 *            The post button in the PostThreadFragment.
 */
public void post(View view) {
    if (geoLocation == null) {
        geoLocation = new GeoLocation(locationListenerService);
    }
    if (geoLocation.getLocation() == null) {
        ErrorDialog.show(getActivity(), "Could not retrieve location. Please specify a custom location.");
        return;
    }
    if (view.getId() == R.id.post_button) {
        String title = null;
        EditText editTitle = null;
        EditText editComment = (EditText) this.getView().findViewById(R.id.commentBody);
        ThreadComment threadComment = null;
        String comment = editComment.getText().toString();
        if (thread == null) {
            editTitle = (EditText) this.getView().findViewById(R.id.titlePrompt);
            title = editTitle.getText().toString();
        }
        if (title != null && title.equals("")) {
            ErrorDialog.show(getActivity(), "Title can not be left blank.");
        } else {
            Comment newComment = new Comment(comment, image, geoLocation, commentToReplyTo);
            if (commentToReplyTo != null) {
                Comment c = thread.findCommentById(thread.getBodyComment(), commentToReplyTo.getId());
                c.addChild(newComment);
                int tag = PreferencesManager.getInstance().getCommentSort();
                SortUtil.sortComments(tag, thread.getBodyComment().getChildren());
            } else {
                threadComment = new ThreadComment(newComment, title);
                CacheManager.getInstance().serializeThreadList(ThreadList.getThreads());
                int tag = PreferencesManager.getInstance().getThreadSort();
                SortUtil.sortThreads(tag, ThreadList.getThreads());
            }
            if (!ConnectivityHelper.getInstance().isConnected()) {
                CacheManager cacheManager = CacheManager.getInstance();
                if (title == null) {
                    cacheManager.addCommentToQueue(newComment);
                } else {
                    cacheManager.addThreadCommentToQueue(threadComment);
                }
                Toaster.toastShort(
                        "No internet connection detected. Your post will automatically send on connection.");
            } else {
                ProgressDialog dialog = new ProgressDialog(getActivity());
                dialog.setMessage("Getting Location Data");
                ThreadManager.startPost(newComment, title, geoLocation, dialog, false);
            }
            InputMethodManager inputManager = (InputMethodManager) getActivity()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            this.getFragmentManager().popBackStackImmediate();
        }
    }
}

From source file:com.easemob.ChuangKeYuan.ui.SettingsFragment.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);
    pd.setCanceledOnTouchOutside(false);
    pd.show();//from   ww w  .j ava 2s .com
    MyHelper.getInstance().logout(true, new EMCallBack() {

        @Override
        public void onSuccess() {
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    ((MainActivity) getActivity()).finish();
                    startActivity(new Intent(getActivity(), LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            getActivity().runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}

From source file:com.grass.caishi.cc.activity.main.FriendsListFragment.java

/**
 * user???//  w w  w.j av a  2s . co m
 */
private void moveToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("???...");
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                // ???
                EMContactManager.getInstance().addUserToBlackList(username, true);
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), "????", Toast.LENGTH_SHORT).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    }).start();

}

From source file:ablgroup.daily2.authentification.AuthentificationFragment.java

private void signIn(String email, String password) {
    Log.d(TAG, "signIn:" + email);
    if (!validateForm()) {
        return;//  w  w w . j a v a2  s.  com
    }

    final ProgressDialog pd = new ProgressDialog(AuthentificationFragment.this);
    pd.setMessage("loading");
    pd.show();

    // [START sign_in_with_email]
    mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this,
            new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "signInWithEmail:onComplete:" + task.isSuccessful());
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithEmail:failed", task.getException());
                        Toast.makeText(AuthentificationFragment.this, R.string.auth_failed, Toast.LENGTH_SHORT)
                                .show();
                    }

                    // [START_EXCLUDE]
                    if (!task.isSuccessful()) {
                        mStatusTextView.setText(R.string.auth_failed);
                    }
                    pd.hide();
                    // [END_EXCLUDE]
                }
            });
    // [END sign_in_with_email]
}