• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Set AlertDialog inner imageview from gallery

On clicking button, an alert dialog appears and there is one image view and three edit texts inside the dialog. By clicking the image view, the screen will move on to the gallery, and after clicking one of the images the gallery closes and the image view should be set with the selected image.

This is what I intended, but with the current code there seems to be a flaw. I managed to go to the gallery, pick up an image and that's it. The selected image is not set on the image view on the dialog. It passes an error Attempt to invoke virtual method 'void android.widget.ImageView.setImageURI(android.net.Uri)' on a null object reference

the imageview is inside dialog and calling listener from inside not main activity..
 

Attachments

  • Recieve_Payment.txt
    13.6 KB · Views: 51

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones