remove_comment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.currentActivity);
alert.setTitle("are you sure?");
alert.setCancelable(true);
alert.setPositiveButton("yeah", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
RequestParams params = new RequestParams();
params.put("comment_id", item.getComment_id());
Internet.post("event/remove_comment", params, "removed");
base.setVisibility(View.GONE);
myevent.get(position).commenter.remove(holder.mpoid);
notifyDataSetChanged();
}
});
alert.setNegativeButton("no", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
alert.show();
}
});
這是我的代碼,用於刪除一條警報,但警報不顯示。正當我點擊後退按鈕顯示所有警報。有任何想法嗎?爲什麼alertdialog沒有顯示給我
它是被創造的onResume
@Override
public void onResume(){
currentActivity=this;
super.onResume();
}
on adapter .... –
@YasirTahir你確定嗎?我只看到alert.create(); 和我想我不能添加alret.build() –
@MikeM。在我的adpter和onBindViewHolder ...在RecyclerView產品這裏...和我的評論daynamicly創建 –