How can we pass any value (selected one) from dialog to activity in android? -
i need pass values custom dialog activity. cannot understand should use. used intent, dialog doesn't support intent value passing . can me here, totally stucked.if have basic example it, excellent. thank you.
snippet google documentation:
// alert dialog code (mostly copied android docs alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("pick color"); builder.setitems(items, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int item) { myfunction(item); } }); alertdialog alert = builder.create(); // elsewhere in activity class, have function private void myfunction(int result){ // data has been "returned" (as pointed out, that's not // right terminology) }
Comments
Post a Comment