我曾在媒体播放器中使用此功能来生成警报对话框并在用户恢复视频时对其做出响应
setPositiveButton-->"Start Over"
setNegitiveButton-->"Resume"
public abstract void onClick (DialogInterface dialog, int which){
//what i need is disable the "RESUME" if user clicked it once...
我在这里粘贴我的整个功能请修改它...
private void showResumeDialog(Context context, final int bookmark) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.resume_playing_title);
builder.setMessage(String.format(
context.getString(R.string.resume_playing_message),
GalleryUtils.formatDuration(context, bookmark / 1000)));
builder.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
onCompletion();
}
});
builder.setPositiveButton(
R.string.resume_playing_resume, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mVideoView.seekTo(bookmark);
startVideo();
}
});
builder.setNegativeButton(
R.string.resume_playing_restart, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startVideo();
}
});
builder.show();
}