本文整理汇总了Java中android.app.ProgressDialog.setButton方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressDialog.setButton方法的具体用法?Java ProgressDialog.setButton怎么用?Java ProgressDialog.setButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ProgressDialog
的用法示例。
在下文中一共展示了ProgressDialog.setButton方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startBindingService
import android.app.ProgressDialog; //导入方法依赖的package包/类
/**
* Binding service after the fine location permission is granted
*/
private void startBindingService() {
// Start GPSService which offers user location across activities
positionDialog = new ProgressDialog(this);
positionDialog.setTitle(getResources().getString(R.string.access_location_title));
positionDialog.setMessage(getResources().getString(R.string.access_location_message));
positionDialog.setIndeterminate(true);
positionDialog.setCancelable(false);
positionDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
positionDialog = null;
}
});
positionDialog.show();
if (isMyServiceRunning(GPSService.class))
bindService(serviceIntent, mConnection, Context.BIND_AUTO_CREATE);
else
super.startService(serviceIntent);
}
示例2: receiveMessages
import android.app.ProgressDialog; //导入方法依赖的package包/类
private void receiveMessages(int i) {
if (checkState == CheckState.EXIST) {
changeState(State.RECEIVEING);
slotIndex = i;
String address = mainActivity.getSavedValue("REMO_DEVICE_ADDRESS");
remoController.recevieMessages(address);
receiveDialog = new ProgressDialog(mainActivity);
receiveDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
receiveDialog.cancel();
}
});
receiveDialog.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
Log.d(TAG, "onCancel: ");
changeState(State.IDLE);
remoController.cancelReceiveMessages();
}
});
receiveDialog.setMessage(getString(R.string.remo_receive_dialog));
receiveDialog.show();
}
}
示例3: onPreExecute
import android.app.ProgressDialog; //导入方法依赖的package包/类
protected void onPreExecute() {
pd = new ProgressDialog(mFragment.getActivity());
pd.setCancelable(false);
pd.setIndeterminate(false);
if (mShouldMove) {
pd.setTitle(R.string.move);
pd.setMessage(mContext.getResources().getString(R.string.moving_file));
} else {
pd.setTitle(R.string.copy);
pd.setMessage(mContext.getResources().getString(R.string.copying_file));
}
pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background),
(arg0, arg1) -> pd.dismiss());
pd.show();
}
示例4: showDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
protected void showDialog() {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EvernoteLoginTask task = (EvernoteLoginTask) TaskExecutor.getInstance().getTask(mTaskKey);
if (task != null) {
task.cancel();
}
onResult(false, task);
}
};
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setMessage(getString(R.string.esdk_loading));
mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), onClickListener);
mProgressDialog.setCancelable(false);
mProgressDialog.show();
}
示例5: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
setCancelable(false);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EvernoteLoginTask task = (EvernoteLoginTask) TaskExecutor.getInstance().getTask(mTaskKey);
if (task != null) {
task.cancel();
}
onResult(false, task);
}
};
ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setIndeterminate(true);
progressDialog.setMessage(getString(R.string.esdk_loading));
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), onClickListener);
progressDialog.setCancelable(isCancelable());
return progressDialog;
}
示例6: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected Dialog onCreateDialog(int id) {
//pDialog.show();
switch (id) {
case progress_bar_type:
pDialog = new ProgressDialog(this);
pDialog.setMessage("Downloading " + u + ".pdf");
pDialog.setIndeterminate(false);
pDialog.setMax(100);
pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pDialog.setCancelable(true);
pDialog.setCanceledOnTouchOutside(false);
pDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, "Background", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Cancel download task
pDialog.cancel();
Toast.makeText(PdfSelector.this,
"Downloading in background", Toast.LENGTH_SHORT).show();
startActivity(new Intent(PdfSelector.this, Subjects.class));
//finish();
}
});
pDialog.show();
return pDialog;
default:
return null;
}
}
示例7: getCityByLocation
import android.app.ProgressDialog; //导入方法依赖的package包/类
void getCityByLocation() {
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.ACCESS_FINE_LOCATION)) {
// Explanation not needed, since user requests this himself
} else {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_ACCESS_FINE_LOCATION);
}
} else if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) ||
locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
progressDialog = new ProgressDialog(this);
progressDialog.setMessage(getString(R.string.getting_location));
progressDialog.setCancelable(false);
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
locationManager.removeUpdates(MainActivity.this);
} catch (SecurityException e) {
e.printStackTrace();
}
}
});
progressDialog.show();
if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
}
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
}
} else {
showLocationSettingsDialog();
}
}
示例8: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Log.d(TAG, "onCreateDialog");
mDialog = new ProgressDialog(getActivity());
mDialog.setIndeterminate(true);
mDialog.setCancelable(false);
mDialog.setMessage(getString(R.string.zipping_library_before_mailing));
mDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dismiss();
}
});
return mDialog;
}
示例9: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
protected Dialog onCreateDialog(int id) {
//pDialog.show();
switch (id) {
case progress_bar_type:
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("Uploading " + u + ".pdf");
progressDialog.setIndeterminate(false);
progressDialog.setMax(100);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(true);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setButton(ProgressDialog.BUTTON_NEGATIVE, "Background", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Cancel download task
progressDialog.cancel();
Toast.makeText(Topics.this,
"Uploading in background", Toast.LENGTH_SHORT).show();
startActivity(new Intent(Topics.this, Subjects.class));
//finish();
}
});
progressDialog.show();
return progressDialog;
default:
return null;
}
}
示例10: record
import android.app.ProgressDialog; //导入方法依赖的package包/类
@ProtoMethod(description = "Starts recording", example = "")
@ProtoMethodParam(params = {"showProgressBoolean"})
public PAudioRecorder record(String fileName) {
init();
recorder.setOutputFile(getAppRunner().getProject().getFullPathForFile(fileName));
try {
recorder.prepare();
} catch (Exception e) {
e.printStackTrace();
}
if (showProgress && getActivity() != null) {
mProgressDialog = new ProgressDialog(getActivity());
mProgressDialog.setTitle("Record!");
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Stop recording",
new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int whichButton) {
mProgressDialog.dismiss();
stop();
}
});
mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface p1) {
stop();
}
});
mProgressDialog.show();
}
recorder.start();
return this;
}
示例11: onCreateDialog
import android.app.ProgressDialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String type = getArguments().getString("type");
progress = new ProgressDialog(getActivity());
Window window = progress.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
switch (type) {
case "meme_scan":
progress.setMax(100);
progress.setMessage(getString(R.string.meme_scanning));
progress.setTitle(getString(R.string.meme_scan_connect_title));
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setCancelable(false);
/*
progress.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel),
new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (mListener != null) {
mListener.doNegativeClick("meme_connect");
}
}
});
*/
break;
case "meme_connect":
progress.setMax(100);
progress.setMessage(getString(R.string.meme_scanning));
progress.setTitle(getString(R.string.meme_scan_connect_title));
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setCancelable(false);
progress.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel),
new OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (mListener != null) {
mListener.doNegativeClick("meme_connect");
}
}
});
break;
case "hue_search":
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setMessage(getString(R.string.hue_searching));
progress.setCancelable(false);
break;
case "hue_connect":
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setMessage(getString(R.string.hue_push_link_button));
progress.setCancelable(false);
break;
case "spotify_loading":
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setMessage(getString(R.string.spotify_loading));
progress.setCancelable(false);
break;
}
return progress;
}
示例12: handleMessage
import android.app.ProgressDialog; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_STATE_CONNECTING:
mProcessDialog = ProgressDialog.show(PCLinkLibraryCommuTestActivity.this, null,
getString(R.string.connection_meter_and_get_result), true);
mProcessDialog.setCancelable(false);
break;
case MESSAGE_STATE_SCANED_DEVICE:
// 取得Bluetooth Device資訊
final BluetoothDevice device = BluetoothUtil.getPairedDevice(mConnection.getConnectedDeviceAddress());
// Attempt to connect to the device
mConnection.LeConnect(getApplicationContext(), device);
// 在mLeConnectedListener會收
break;
case MESSAGE_STATE_CONNECT_DONE:
dimissProcessDialog();
break;
case MESSAGE_STATE_CONNECT_FAIL:
dimissProcessDialog();
showAlertDialog(R.string.connect_meter_fail, true);
break;
case MESSAGE_STATE_CONNECT_NONE:
//showAlertDialog(PCLinkLibraryCommuTestActivity.this, "00000");
dimissProcessDialog();
if (PCLinkLibraryDemoConstant.PL2303_TRANSFER_TYPE.equals(mBtTransferType)) {
Bundle bundle = new Bundle();
bundle.putBoolean(PCLinkLibraryDemoConstant.FromPL2303, true);
GuiUtils.goToSpecifiedActivity(PCLinkLibraryCommuTestActivity.this,
PCLinkLibraryDemoActivity.class, bundle);
}
else {
GuiUtils.goToPCLinkLibraryHomeActivity(PCLinkLibraryCommuTestActivity.this);
}
break;
case MESSAGE_STATE_CONNECT_METER_SUCCESS:
showAlertDialog(R.string.connect_meter_success, false);
break;
case MESSAGE_STATE_CHECK_METER_BT_DISTENCE:
ProgressDialog baCmdDialog = new ProgressDialog(
PCLinkLibraryCommuTestActivity.this);
baCmdDialog.setCancelable(false);
baCmdDialog.setMessage("send ba command");
baCmdDialog.setButton(DialogInterface.BUTTON_POSITIVE, "cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Use either finish() or return() to either close the activity
// or just
// the dialog
dialog.dismiss();
mBACmdThread = null;
return;
}
});
baCmdDialog.show();
break;
case MESSAGE_STATE_CHECK_METER_BT_DISTENCE_FAIL:
mBACmdThread = null;
showAlertDialog(R.string.check_bt_fail, true);
break;
case MESSAGE_STATE_NOT_SUPPORT_METER:
dimissProcessDialog();
showAlertDialog(R.string.not_support_meter, true);
break;
case MESSAGE_STATE_NOT_CONNECT_SERIAL_PORT:
showAlertDialog(R.string.not_connect_serial_port, true);
break;
} /* end of switch */
}
示例13: onCreate
import android.app.ProgressDialog; //导入方法依赖的package包/类
/**
* @brief The Android onCreate method
* @details The Android onCreate method. Initializes the CanvasView, SlidingMenu, VncBridgeJNI.
* Also calls the method to start the connection
*/
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//No se muestra la barra de accion superior
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.canvas);
canvas = (CanvasView)findViewById(R.id.vnc_canvas);
Bundle info = getIntent().getExtras();
progressDialog = new ProgressDialog(this);
final String load = getString(R.string.loadingtext);
final String loadImage = getString(R.string.loadingbodytext);
progressDialog.setTitle(load);
progressDialog.setMessage(loadImage);
final String cancel = getString(R.string.cancel);
progressDialog.setButton(cancel, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
vnc.finishVnc();
finishConnection();
}
});
progressDialog.show();
progressDialog.setCancelable(false);
menu = new SlidingMenu(this);
startSlideMenu();
runTimerConnection();
String aux_quality = info.getString("color");
QualityArray quality = QualityArray.valueOf(aux_quality);
iniConnection(info.getString("ip"), info.getString("port"),info.getString("psw"),quality,info.getBoolean("wifi"));
inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
GestureListener gestureListener = new GestureListener();
gesture = new GestureDetector(gestureListener);
scaleGesture = new ScaleGestureDetector(this,gestureListener);
endScrollRun = new Runnable() {
@Override
public void run() {
while(drag || oneLoopMore){
oneLoopMore = false;
try {
Thread.sleep(TIMER_SCROLL);
} catch (InterruptedException e) {
// Auto-generated catch block
}
}
canvas.endDrag();
}
};
}