本文整理汇总了Java中android.support.v7.app.AlertDialog.Builder类的典型用法代码示例。如果您正苦于以下问题:Java Builder类的具体用法?Java Builder怎么用?Java Builder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Builder类属于android.support.v7.app.AlertDialog包,在下文中一共展示了Builder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPasswordResetClicked
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
public void onPasswordResetClicked(View v) {
SEGAnalytics.track("Auth: Request password reset");
final String email = emailView.getText().toString();
if (isEmailValid(email)) {
performReset();
} else {
new Builder(this)
.setTitle(getString(R.string.reset_password_dialog_title))
.setMessage(getString(R.string.reset_paassword_dialog_please_enter_a_valid_email))
.setPositiveButton(R.string.ok, (dialog, which) -> {
dialog.dismiss();
emailView.requestFocus();
})
.show();
}
}
示例2: onWifiDisabled
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void onWifiDisabled() {
log.d("Wi-Fi disabled; prompting user");
new AlertDialog.Builder(this)
.setTitle(R.string.wifi_required)
.setPositiveButton(R.string.enable_wifi, (dialog, which) -> {
dialog.dismiss();
log.i("Enabling Wi-Fi at the user's request.");
wifiFacade.setWifiEnabled(true);
wifiListFragment.scanAsync();
})
.setNegativeButton(R.string.exit_setup, (dialog, which) -> {
dialog.dismiss();
finish();
})
.show();
}
示例3: onMaxAttemptsReached
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void onMaxAttemptsReached() {
if (!isResumed) {
finish();
return;
}
String errorMsg = Phrase.from(this, R.string.unable_to_connect_to_soft_ap)
.put("device_name", getString(R.string.device_name))
.format().toString();
new AlertDialog.Builder(this)
.setTitle(R.string.error)
.setMessage(errorMsg)
.setPositiveButton(R.string.ok, (dialog, which) -> {
dialog.dismiss();
startActivity(new Intent(DiscoverDeviceActivity.this, GetReadyActivity.class));
finish();
})
.show();
}
示例4: prepareDownload
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void prepareDownload() {
if (!HttpUtils.isNetworkAvailable(this)) {
Helper.showToast((CharSequence) "当前处于无网环境,无法下载");
} else if (HttpUtils.isWifiConnection(this)) {
this.menuDownload.setTitle("下载中");
DownloadService.intentDownload(this, this.mRecord);
} else {
new Builder(this).setMessage(getString(R.string.jn)).setPositiveButton((CharSequence)
"继续下载", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SportDetailActivity.this.menuDownload.setTitle("下载中");
DownloadService.intentDownload(SportDetailActivity.this, SportDetailActivity
.this.mRecord);
}
}).setNegativeButton((CharSequence) "取消", null).show();
}
}
示例5: showDeleteDialog
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void showDeleteDialog() {
if (this.mAdapter.getSelectVideos().size() == 0) {
Helper.showToast((CharSequence) "请选择要删除的视频");
} else {
new Builder(this).setTitle((CharSequence) "清除视频缓存").setMessage((CharSequence)
"清除视频缓存后,已下载的运动视频需要重新下载").setPositiveButton((CharSequence) "确定清除", new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
DownloadHelper.getInstance().deleteDownload(DownloadManageActivity.this
.mAdapter.getSelectVideos());
DownloadManageActivity.this.mAdapter.setList(DownloadHelper.getInstance()
.getRecordsList());
DownloadManageActivity.this.changeEditMode(DownloadManageActivity.this
.menuEdit);
if (DownloadHelper.getInstance().getRecordsList().size() == 0) {
DownloadManageActivity.this.showEmpty();
}
}
}).setNegativeButton((CharSequence) "取消", null).show();
}
}
示例6: submitOrder
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void submitOrder(final int orderId, final int position) {
new Builder(this.ctx).setTitle((CharSequence) "确认收货").setMessage((CharSequence)
"是否确认收货?").setPositiveButton((CharSequence) "确定", new DialogInterface
.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
ShopApi.finishOrder(orderId, OrderListAdapter.this.ctx, new JsonCallback
(OrderListAdapter.this.ctx) {
public void onFinish() {
OrderListAdapter.this.orders.remove(position);
OrderListAdapter.this.notifyDataSetChanged();
}
public void fail(String message) {
Helper.showToast((CharSequence) message);
}
});
}
}).setNegativeButton((CharSequence) "取消", null).show();
}
示例7: show
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
public void show(IBinder windowToken) {
MenuBuilder menu = this.mMenu;
Builder builder = new Builder(menu.getContext());
this.mPresenter = new ListMenuPresenter(builder.getContext(), R.layout.abc_list_menu_item_layout);
this.mPresenter.setCallback(this);
this.mMenu.addMenuPresenter(this.mPresenter);
builder.setAdapter(this.mPresenter.getAdapter(), this);
View headerView = menu.getHeaderView();
if (headerView != null) {
builder.setCustomTitle(headerView);
} else {
builder.setIcon(menu.getHeaderIcon()).setTitle(menu.getHeaderTitle());
}
builder.setOnKeyListener(this);
this.mDialog = builder.create();
this.mDialog.setOnDismissListener(this);
LayoutParams lp = this.mDialog.getWindow().getAttributes();
lp.type = CloseFrame.REFUSE;
if (windowToken != null) {
lp.token = windowToken;
}
lp.flags |= 131072;
this.mDialog.show();
}
示例8: showImageSelectionPopup
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
public void showImageSelectionPopup(final Fragment fragment, final int requestCodeCapture, final int requestCodePick) {
new Builder(fragment.getContext()).setTitle(string.pick_image_from)
.setItems(array.pick_image_option_list_array, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
startPickImage();
} else if (which == 1) {
Intent PickImageintent = new Intent().setType("image/*").setAction(Intent.ACTION_GET_CONTENT);
if (PickImageintent.resolveActivity(fragment.getContext().getPackageManager()) != null) {
fragment.startActivityForResult(PickImageintent, requestCodePick);
} else {
Toast.makeText(fragment.getContext(), string.cc_error_img_picker, Toast.LENGTH_SHORT).show();
}
}
}
}).create().show();
}
示例9: showVideoSelectionPopup
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
public static void showVideoSelectionPopup(final Fragment fragment, final int requestCodeCapture, final int requestCodePick) {
new Builder(fragment.getContext()).setTitle(string.cc_pick_video_from)
.setItems(array.pick_video_option_list_array, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
if (takePictureIntent.resolveActivity(fragment.getContext().getPackageManager()) != null) {
fragment.startActivityForResult(takePictureIntent, requestCodeCapture);
} else {
Toast.makeText(fragment.getContext(), string.cc_no_camera_app, Toast.LENGTH_SHORT).show();
}
} else if (which == 1) {
Intent PickImageintent = new Intent().setType("video/*").setAction(Intent.ACTION_GET_CONTENT);
if (PickImageintent.resolveActivity(fragment.getContext().getPackageManager()) != null) {
fragment.startActivityForResult(PickImageintent, requestCodePick);
} else {
Toast.makeText(fragment.getContext(), string.cc_no_video_picker, Toast.LENGTH_SHORT).show();
}
}
}
}).create().show();
}
示例10: computeDialogDisplay
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
/**
* Methods that computes and displays the dialog content.
*
* @param isForAnnouncement boolean
*/
private final void computeDialogDisplay(boolean isForAnnouncement)
{
final Builder builder = new Builder(getContext());
builder.setTitle(R.string.out_of_app_push_notifications_dialog_title);
final View dialogContainerView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_out_of_app_push_notifications, (ViewGroup) getView().getParent(), false);
iconTitleMessageButton = dialogContainerView.findViewById(R.id.iconTitleMessageButton);
iconTitleMessageBigTextButton = dialogContainerView.findViewById(R.id.iconTitleMessageBigTextButton);
iconTitleMessageBigImageButton = dialogContainerView.findViewById(R.id.iconTitleMessageBigImageButton);
this.isForAnnouncement = isForAnnouncement;
iconTitleMessageButton.setOnClickListener(this);
iconTitleMessageBigTextButton.setOnClickListener(this);
iconTitleMessageBigImageButton.setOnClickListener(this);
builder.setView(dialogContainerView);
this.alertDialog = builder.create();
this.alertDialog.show();
AzmeTracker.sendEvent(getActivity(), isForAnnouncement ? "display_out_of_app_announcement" : "display_out_of_app_notification_only");
}
开发者ID:Azure,项目名称:azure-mobile-engagement-app-android,代码行数:26,代码来源:OutOfAppPushNotificationsFragment.java
示例11: onCreateDialog
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(final Activity activity, final Bundle savedInstanceState) {
AlertDialog.Builder builder = new Builder(activity);
builder.setTitle("title");
builder.setPositiveButton("OK", new OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
//activity.startActivity(new Intent(activity, MainActivity.class));
}
});
builder.setMessage("msg");
//new Handler().postDelayed(new Runnable() {
// @Override
// public void run() {
// activity.finish();
// }
//}, 1000);
return builder.create();
}
示例12: onPasswordResetClicked
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
public void onPasswordResetClicked(View v) {
SEGAnalytics.track("Auth: Request password reset");
final String email = emailView.getText().toString();
if (isEmailValid(email)) {
performReset();
} else {
new Builder(this)
.setTitle(getString(R.string.reset_password_dialog_title))
.setMessage(getString(R.string.reset_paassword_dialog_please_enter_a_valid_email))
.setPositiveButton(R.string.ok, (dialog, which) -> {
dialog.dismiss();
emailView.requestFocus();
})
.show();
}
}
示例13: showAlertDialog
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
/**
* Shows message in an AlertDialog.
*
* @param message contains identify results processed into a string.
*/
private void showAlertDialog(StringBuilder message) {
Builder alertDialogBuilder = new Builder(this);
// set title
alertDialogBuilder.setTitle("Number of elements found");
// set dialog message
alertDialogBuilder
.setMessage(message)
.setCancelable(false)
.setPositiveButton("Ok", new OnClickListener() {
@Override public void onClick(DialogInterface dialog, int id) {
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show the alert dialog
alertDialog.show();
}
示例14: onResetAttemptFinished
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void onResetAttemptFinished(String content) {
new AlertDialog.Builder(this)
.setMessage(content)
.setPositiveButton(R.string.ok, (dialog, which) -> {
dialog.dismiss();
finish();
})
.show();
}
示例15: onLocationDisabled
import android.support.v7.app.AlertDialog.Builder; //导入依赖的package包/类
private void onLocationDisabled() {
log.d("Location disabled; prompting user");
new Builder(this).setTitle(R.string.location_required)
.setMessage(R.string.location_required_message)
.setPositiveButton(R.string.enable_location, ((dialog, which) -> {
dialog.dismiss();
log.i("Sending user to enabling Location services.");
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}))
.setNegativeButton(R.string.exit_setup, ((dialog, which) -> {
dialog.dismiss();
finish();
}))
.show();
}