下面列出了android.app.ProgressDialog#setMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void detectLocation() {
if (WidgetRefreshIconService.isRotationActive) {
return;
}
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.setMessage(getString(R.string.progressDialog_gps_locate));
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setCancelable(false);
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
dialog.dismiss();
} catch (SecurityException e) {
appendLog(MainActivity.this, TAG, "Cancellation error", e);
}
}
});
updateNetworkLocation();
mProgressDialog.show();
refreshDialogHandler = new Handler(Looper.getMainLooper());
}
public <T> void execute(Command<T> cmd, int title) {
final ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setMessage(getString(title));
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.show();
cmd.start(new CommandCallback<T>() {
@Override
public void onResult(T res) {
dismissDialog(progressDialog);
}
@Override
public void onError(Exception e) {
dismissDialog(progressDialog);
}
});
}
@Override
protected void onPreExecute() {
progressDialog = new ProgressDialog(context);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(false);
progressDialog.setTitle(R.string.trimmer__deleting);
progressDialog.setMessage(context.getString(R.string.trimmer__deleting_old_messages));
progressDialog.setMax(100);
progressDialog.show();
}
@Override
public void showDialog() {
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setCancelable(true);// 点击可以取消Dialog的展现
pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pDialog.setMessage("正在更新...");
pDialog.show();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
setContentView(R.layout.activity_main);
webView = (WebView) findViewById(R.id.webView);
edt = (EditText) findViewById(R.id.edt);
btn_getData = (Button) findViewById(R.id.btn_getData);
pd = new ProgressDialog(this);
pd.setMessage("请稍后...");
edt.setText(path);
pd.show();
initWebView();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = getContext();
mProgressDialog = new ProgressDialog(context);
mProgressDialog.setMessage("Loading,Please wait...");
mProgressDialog.setTitle("Loading");
mProgressDialog.setCancelable(false);
mProgressDialog.setCanceledOnTouchOutside(false);
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ProgressDialog dialog = new ProgressDialog(getActivity());
dialog.setIndeterminate(true);
dialog.setMessage(getString(R.string.disconnecting));
setCancelable(false);
return dialog;
}
@Override
protected void onPreExecute() {
dialog = new ProgressDialog(getActivity());
dialog.setMessage(appContext.getString(R.string.prefs_copying_app_files));
dialog.setCancelable(false);
dialog.show();
}
public static ProgressDialog showSpinnerDialog(Activity activity) {
// activity = modifyDialogContext(activity);
ProgressDialog dialog = new ProgressDialog(activity);
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.setCancelable(true);
dialog.setMessage("加载中...");
if (activity.isFinishing() == false) {
dialog.show();
}
return dialog;
}
protected void onPreExecute() {
progressDialog = new ProgressDialog(activity);
progressDialog.setMessage(activity.getString(R.string.deleting));
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setIndeterminate(true);
progressDialog.setProgressNumberFormat(null);
progressDialog.setProgressPercentFormat(null);
progressDialog.setCancelable(false);
progressDialog.show();
}
protected void onPreExecute() {
if (mShowProgressDialog) {
dialog = new ProgressDialog(mContext);
dialog.setMessage(mContext.getString(R.string.android_auto_update_dialog_checking));
dialog.show();
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//初始化ProgressDialog
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage(getResources().getString(R.string.str_loading));
dialog.setCanceledOnTouchOutside(false);
dlg = dialog;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final ProgressDialog dialog = new ProgressDialog(getActivity(), android.R.style.Theme_DeviceDefault_Dialog);
dialog.setMessage(getString(R.string.copy_dialog_message));
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.setIndeterminate(true);
dialog.setOnShowListener(this);
return dialog;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
pd = new ProgressDialog(OrderDetailActivity.this);
pd.setMessage("处理中...");
if(!pd.isShowing()){
pd.show();
}
pd.show();
}
private void showProgressDialog() {
wifiListFragment.stopAggroLoading();
String msg = Phrase.from(this, R.string.connecting_to_soft_ap)
.put("device_name", getString(R.string.device_name))
.format().toString();
connectToApSpinnerDialog = new ProgressDialog(this);
connectToApSpinnerDialog.setMessage(msg);
connectToApSpinnerDialog.setCancelable(false);
connectToApSpinnerDialog.setIndeterminate(true);
connectToApSpinnerDialog.show();
}
private void showProgressDialog(String title)
{
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
pDialog.setMessage(title+"...");
pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pDialog.show();
}
private void prepareProgressDialog(){
progressDialog = new ProgressDialog(this);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setMessage("Processing Image data");
progressDialog.show();
}
private void buildProgressDialog(){
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
pDialog.setMessage("loading ...");
}
public static void startProgressDialog() {
progressDialog = new ProgressDialog(A.getMain());
progressDialog.setMessage(Locale.getString(R.string.loading));
progressDialog.show();
}
private void updateStatus(String status) {
final ProgressDialog progressDlg = new ProgressDialog(this);
progressDlg.setMessage("Sending...");
progressDlg.setCancelable(false);
progressDlg.show();
TwitterRequest request = new TwitterRequest(mTwitter.getConsumer(), mTwitter.getAccessToken());
String updateStatusUrl = "https://api.twitter.com/1.1/statuses/update.json";
List<NameValuePair> params = new ArrayList<NameValuePair>(1);
params.add(new BasicNameValuePair("status", status));
request.createRequest("POST", updateStatusUrl, params, new TwitterRequest.RequestListener() {
@Override
public void onSuccess(String response) {
progressDlg.dismiss();
showToast(response);
Debug.i(response);
}
@Override
public void onError(String error) {
showToast(error);
progressDlg.dismiss();
}
});
}