本文整理匯總了Java中android.support.v7.app.AlertDialog.show方法的典型用法代碼示例。如果您正苦於以下問題:Java AlertDialog.show方法的具體用法?Java AlertDialog.show怎麽用?Java AlertDialog.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.app.AlertDialog
的用法示例。
在下文中一共展示了AlertDialog.show方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showComparationResultsDialog
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void showComparationResultsDialog(DecimalFormat decimalFormat){
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
alert.setTitle(getString(R.string.comparation_results_dialog_title));
alert.setMessage("IMU:" +
"\n X = " + decimalFormat.format(xSensorAxis) +
"\n Y = " + decimalFormat.format(ySensorAxis) +
"\nCamera:" +
"\n X = " + decimalFormat.format(checkerboardPatternComputingInitializer.getxAxis()) +
"\n Y = " + decimalFormat.format(checkerboardPatternComputingInitializer.getyAxis()));
alert.setPositiveButton(getString(R.string.comparation_results_dialog_positive_button_text), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog comparationResultsDialog = alert.create();
comparationResultsDialog.show();
}
示例2: showModeDialog
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
void showModeDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("");
builder.setSingleChoiceItems(sModes.toArray(new String[0]),
Prefs.getMode(MainActivity.this),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Prefs.setMode(MainActivity.this, item);
Toast.makeText(getApplicationContext(),
"Selected: "+ sModes.get(item), Toast.LENGTH_SHORT).show();
dialog.dismiss();// dismiss the alertbox after chose option
refreshResults();
}
});
AlertDialog alert = builder.create();
alert.show();
}
示例3: startPopUpInfo
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
public void startPopUpInfo(SmsType smsType) {
MiscUtils.showNotification(
mContext,
mContext.getString(smsType.getAlert()),
mContext.getString(R.string.app_name_short) + " - " + mContext.getString(smsType.getTitle()),
R.drawable.sense_danger,
true);
AlertDialog alertDialog = new AlertDialog.Builder(mContext)
.setTitle(smsType.getTitle())
.setMessage(smsType.getMessage())
.setIcon(R.drawable.sense_danger)
.create();
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
alertDialog.show();
}
示例4: showRequestDialog
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void showRequestDialog() {
mPermissionsDialog = true;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.permissions)
.setMessage(R.string.permissions_info)
.setCancelable(false)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
PermissionUtils.requestForStoragePermission(MainFragment.this);
mPermissionsDialog = false;
}
});
AlertDialog alert = builder.create();
alert.show();
}
示例5: showResultDialog
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void showResultDialog(final String message, int code) {
try {
final AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(getString(com.mobillium.paparasdk.R.string.title))
.setMessage(message + " (" + code + ")")
.setPositiveButton(getString(R.string.done), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
})
.create();
dialog.setCanceledOnTouchOutside(false);
dialog.show();
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例6: displayCreateEventErrorMessage
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
/**
* Displays the event name error message
* @param eventName
* @param description
*/
private void displayCreateEventErrorMessage(String eventName,
String description,
String date) {
Context context = getApplicationContext();
AlertDialog.Builder mBuilder = new AlertDialog.Builder(CreateEventActivity.this);
mBuilder.setIcon(R.drawable.activist_watch_logo_small);
mBuilder.setTitle("Oops!");
mBuilder.setMessage("Event Name, Description, and/or Date left blank!");
mBuilder.setCancelable(false);
mBuilder.setPositiveButton("DISMISS", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog alertDialog = mBuilder.create();
alertDialog.show();
}
示例7: showSaveHistoryDialog
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void showSaveHistoryDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style
.AlertDialogStyle);
builder.setTitle(R.string.save_history)
.setMessage(R.string.save_history_desc)
.setCancelable(false)
.setNegativeButton(R.string.no,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
leaveRoom();
}
})
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
saveHistory();
leaveRoom();
}
});
AlertDialog alert = builder.create();
alert.show();
alert.getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color
.black14)));
}
示例8: DisplaySimpleResource
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void DisplaySimpleResource(String title, int fileResourceId) {
// Linkify the message
final SpannableString msg = new SpannableString(IOUtilities.InputStreamToString(getResources().openRawResource(fileResourceId)));
Linkify.addLinks(msg, Linkify.ALL);
final AlertDialog d = new AlertDialog.Builder(this, R.style.SimpleDialogTheme)
.setPositiveButton(android.R.string.ok, null)
.setTitle(title)
.setMessage(msg)
.create();
d.show();
// Make the textview clickable. Must be called after show()
((TextView)d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}
示例9: onClick
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
List<Rule> rules = new ArrayList<>();
for (Rule rule : getEntry().mRules)
rules.add(new Rule(rule));
if (rules.size() == 0)
rules.add(new Rule());
View view = LayoutInflater.from(itemView.getContext()).inflate(
R.layout.settings_reconnect_dialog, null);
RecyclerView recyclerView = view.findViewById(R.id.rules);
RulesAdapter adapter = new RulesAdapter(rules);
recyclerView.setLayoutManager(new LinearLayoutManager(itemView.getContext()));
recyclerView.setAdapter(adapter);
AlertDialog dialog = new ThemedAlertDialog.Builder(v.getContext())
.setPositiveButton(R.string.action_ok, (DialogInterface dialogInterface, int which) -> {
getEntry().setRules(rules);
})
.setView(view)
.setTitle(getEntry().mName)
.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
adapter.setDialog(dialog);
dialog.show();
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
}
示例10: onPostExecute
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
@SuppressLint({"SetTextI18n", "InflateParams"})
@Override
protected void onPostExecute(Boolean result) {
dbh.close();
long[] interval = result ? new long[]{0, 200, 100, 200} : new long[]{0, 1000, 500, 1000};
final AlertDialog dialog = new FeedbackDialog(Utils.getController().getEssensbonActivity(), result, orderedMenu);
Vibrator vb = (Vibrator) Utils.getContext().getSystemService(Context.VIBRATOR_SERVICE);
vb.vibrate(interval, -1);
if (EssensbonUtils.isAutoFadeEnabled()) {
int duration = EssensbonUtils.getFadeTime();
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
dialog.dismiss();
}
}, duration * 1000);
}
dialog.show();
}
示例11: resolve
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
/**
* Resolve whether the DownloadManager is enable in current devices.
*
* @return true if DownloadManager is enable, false otherwise.
*/
public static boolean resolve(Context context) {
boolean enable = resolveEnable(context);
if (!enable) {
AlertDialog alertDialog = createDialog(context);
alertDialog.show();
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE)
.setTextColor(ContextCompat.getColor(context, R.color.colorAccent));
}
return enable;
}
示例12: displayError
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
@Override
public void displayError() {
AlertDialog alertDialog = new AlertDialog.Builder(this)
.setMessage("There was an error")
.create();
alertDialog.show();
}
示例13: showFilterDialogue
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void showFilterDialogue() {
//get alert dialog view
View alertDialogView = Utils.getAlertDialogView(this);
//get alert dialog instance
AlertDialog dialog = Utils.getAlertDialog(this, alertDialogView,
this::refreshList);
dialog.show();
}
示例14: showError
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void showError(String message, String button) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(message);
builder.setPositiveButton(
button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
示例15: visitInterface
import android.support.v7.app.AlertDialog; //導入方法依賴的package包/類
private void visitInterface() {
AlertDialog.Builder messageBoxBuilder = new AlertDialog.Builder(KidDetail.this);
messageBoxBuilder.setCancelable(true);
String[] options = {"Add a new visit","See visit history"};
messageBoxBuilder.setTitle("Visits");
messageBoxBuilder.setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(which == 0){newVisitDialog();}
else if(which == 1){visitHistoryDialog();}
}
});
AlertDialog messageBox = messageBoxBuilder.create();
messageBox.show();
}