Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Data Persistence CRUD Operations with SQLite Deleting Data

cant add pictures from gallery in meme maker app.

I followed through the whole course and the app seems to be running fine but when i try to add a picture in the app through the gallery the picture is never displayed in the images tab. I'm not sure what I am missing?

Mikael Enarsson
Mikael Enarsson
7,056 Points

I'm sorry to say it like this, but I'm a bit drunk, and a bit of code would be helpful.

I was just wondering if it works for anyone else.

Nope. I moved on.

1 Answer

Hi,

I just solved this. You need to override the "onActivityResult" method in the ImageGridFragment as well, since its currently only in the activity fragment but there's no interface talking back tot he mainActivity so it just gets lost. Easiest solution is to generate the OnActivityResult override method using your IDE (If you copy paste it produces warnings) and then copy the body of that method from MainActivity to the ImageGridFragment. The issue you'll then run into is that you need to notify the GridAdapter that the data set has been changed. At the end of the all the code inside the result_ok if statement, put mGridAdapter.notifyDataSetChanged();