本文整理汇总了Java中android.app.AlertDialog.Builder.create方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.create方法的具体用法?Java Builder.create怎么用?Java Builder.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.AlertDialog.Builder
的用法示例。
在下文中一共展示了Builder.create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onCreateDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
protected Dialog onCreateDialog(int id) {
if (id == 0) {
Builder builder = new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_menu_generic).setTitle(
R.string.pref_about);
View view = getLayoutInflater().inflate(R.layout.about, null);
TextView info = (TextView) view.findViewById(R.id.about_info);
info.setText(Html.fromHtml(getString(R.string.about_info, getVersionNumber(this))));
builder.setView(view);
builder.setNegativeButton(R.string.btn_close, new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
return null;
}
示例3: 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;
}
示例4: changeTextDirection
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void changeTextDirection(Builder dlg){
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
dlg.create();
AlertDialog dialog = dlg.show();
if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
TextView messageview = (TextView)dialog.findViewById(android.R.id.message);
messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
}
}
示例5: run
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
public void run() {
Builder builder = new Builder(InCallActivity.this);
Resources r = getResources();
builder.setTitle("ZRTP supported by remote party");
builder.setMessage("Do you confirm the SAS : " + sasString);
builder.setPositiveButton(r.getString(R.string.yes), this);
builder.setNegativeButton(r.getString(R.string.no), this);
AlertDialog backupDialog = builder.create();
backupDialog.show();
}
示例6: createDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
private Dialog createDialog(int titleId, int textId, boolean twoButtons) {
Builder builder = new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_menu_generic).setTitle(titleId)
.setMessage(textId);
if (twoButtons) {
builder.setPositiveButton(R.string.btn_accept, this);
builder.setNegativeButton(R.string.btn_calcel, this);
} else {
builder.setNeutralButton(R.string.btn_close, this);
}
return builder.create();
}
示例7: getCommonStructure
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static Dialog getCommonStructure(final Context context, String messageStr,
DialogInterface.OnClickListener positiveListener) {
Builder builder = new Builder(context);
builder.setMessage(messageStr);
builder.setPositiveButton(R.string.yes_button_txt, positiveListener)
.setNegativeButton(R.string.no_button_txt, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
示例8: onClick
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
public void onClick() {
if(getOnPreferenceClickListener()==null){
mCurrentDirectory =new File("/");
final EditText ed = new EditText(getContext());
ed.setText(getSharedPreferences().getString(getKey(), defaultBlocklist));
Builder b = new Builder(getContext());
b.setTitle(R.string.torrent_blocklist_url);
b.setView(ed);
b.setNegativeButton(android.R.string.cancel, null);
b.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(ed.getText().toString().isEmpty()){
showErrorDialog(getErrorString(-3));
return;
}
//trying to download
Uri uri = Uri.parse(ed.getText().toString());
String path = "";
String query = "";
try {
if(uri.getPath()!=null)
path= URLEncoder.encode(uri.getPath(), "UTF-8").replace("+", "%20").replace("%2F", "/");
if(uri.getQuery()!=null){
for(String param : uri.getQueryParameterNames()){
if(!query.isEmpty())
query+="&";
query+=URLEncoder.encode(param, "UTF-8")+"=";
query+=uri.getQueryParameter(param);
}
}
} catch (UnsupportedEncodingException e) {
return;
}
startDownload(uri.getScheme()+"://"+uri.getHost()+path+(!query.isEmpty()?"?"+query:""));
}
});
od =b.create();
od.show();
}
}