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

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -