本文整理匯總了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();
}
}