java - intent in alart dialog -
intent in alart dialog how pass in next intent
alertdialogbuilder .setcancelable(false) .setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { string title = edittexttitle.gettext().tostring().trim(); string r=android.get(i).getpassword(); if(title.equals(r)){ view.getcontext().startactivity(new intent(activity,detailview.class)); toast.maketext(view.getcontext()," user name " , toast.length_long).show(); } else { toast.maketext(view.getcontext()," user name not valid " , toast.length_long).show(); } // sendmessage(user.getid(), title, message); } }) .setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } }); alertdialog alertdialog = alertdialogbuilder.create(); alertdialog.show(); } }); }
you need use activity or context, example, please refer below code
alertdialog.builder alertdialogbuilder = new alertdialog.builder(activity) .setcancelable(false) .setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { activity.startactivity(new intent(activity, detailview.class)); } }).setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { dialog.cancel(); } }); alertdialog alertdialog = alertdialogbuilder.create(); alertdialog.show();
you can activity or context contractor.
Comments
Post a Comment