本文整理汇总了Java中android.app.AlertDialog.Builder.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.setIcon方法的具体用法?Java Builder.setIcon怎么用?Java Builder.setIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.AlertDialog.Builder
的用法示例。
在下文中一共展示了Builder.setIcon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static Dialog createDialog(Context context, Bundle arguments, OnClickListener onClickListener) {
Builder builder = new Builder(context);
builder.setTitle(arguments.getString(ErrorDialogManager.KEY_TITLE));
builder.setMessage(arguments.getString(ErrorDialogManager.KEY_MESSAGE));
if (ERROR_DIALOG_ICON != 0) {
builder.setIcon(ERROR_DIALOG_ICON);
}
builder.setPositiveButton(17039370, onClickListener);
return builder.create();
}
示例2: showAlert
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static AlertDialog showAlert(final Context context, final String msg, final String title) {
if (context instanceof Activity && ((Activity) context).isFinishing()) {
return null;
}
final Builder builder = new AlertDialog.Builder(context);
builder.setIcon(R.drawable.ic_dialog_alert);
builder.setTitle(title);
builder.setMessage(msg);
builder.setPositiveButton(R.string.app_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
dialog.cancel();
}
});
final AlertDialog alert = builder.create();
alert.show();
return alert;
}
示例3: showDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static void showDialog(Activity context, String strTitle, String strText, int icon) {
if (context != null && !context.isFinishing() && !context.isRestricted()) {
Builder tDialog = new Builder(context);
tDialog.setIcon(icon);
tDialog.setTitle(strTitle);
tDialog.setMessage(strText);
tDialog.setPositiveButton(R.string.Ensure, null);
try {
tDialog.show();
} catch (Exception e) {
}
}
}
示例4: showError
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
/**
* Show a visual error message to the user.
*
* @param message
* the message to show
*/
private void showError(String message) {
final Builder builder = new AlertDialog.Builder(AlbumListActivity.this);
builder.setTitle(message);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setMessage(message);
builder.show();
}