Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to add images to a gridView. I am pulling my content from Parse.com. I won't have them in the resource folders, so I can't find a tutorial that is useful. This is the code I have thus far;

 progressDialog = ProgressDialog.show(manager.this, "", "Loading images...", true);


    ParseQuery<ParseObject> query = ParseQuery.getQuery("fightGallery");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> parseObjects, com.parse.ParseException e) {
            if (e == null) {
                int i = 0;
                final int size = parseObjects.size();

                while (i < size) {
                    ParseFile fileObject = parseObjects.get(i).getParseFile("image");
                    fileObject.getDataInBackground(new GetDataCallback() {
                        @Override
                        public void done(byte[] bytes, ParseException e) {
                            if (e == null) {
                                Log.d("Data", "We have data successfully");
                                Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
                                ImageView img = (ImageView) findViewById(R.id.imageView);
                                img.setImageBitmap(bmp);
                                Log.d("IMAGES", "IMAGES LOADED SUCCESSFULLY");
                                progressDialog.dismiss();
                            } else {
                                Log.d("ERROR: ", "" + e.getMessage());
                                progressDialog.dismiss();
                            }
                        }
                    });
                    i++;

                }
            } else {
                Log.d("ERROR:", "" + e.getMessage());
                progressDialog.dismiss();
            }
        }
    });

How should I add this to a gallery of any sort. I'm not picky.

share|improve this question
Why can't you store the images in (temporary) folders? It would allow caching and allow you to use almost any technique you like for galleries. – Avery Aug 7 at 16:02
How would I store in a temp folder? Links? And when I try to use my "techniques" for the galleries, they are a specific list size, and a specific name. Then I am still trying to use a bunch of images without a known size or name. – Binghammer Aug 7 at 16:06
1  
Given that you already have the data, its simple enough to write it to a file with a name of your choice in a folder of (mostly) your choice. Google is your friend there. For the galleries, what you need to do is adapt the code that loads the images with an algorithm that finds your images, whether its by hardcoded names, by loading all in a folder, or other methods. – Avery Aug 7 at 16:11
I understand what you are getting at, but I am not sure how EXACTLY how to do it. I didn't know this could be done. Do you know any links or tutorials? – Binghammer Aug 7 at 16:20
Sorry to be "that guy" but: google.com. It's not possible for SO to teach everyone how to do things. Go try some things, post new, SPECIFIC questions and we can help better. – Avery Aug 7 at 16:58
show 2 more comments

This question has an open bounty worth +50 reputation from Binghammer ending tomorrow.

This question has not received enough attention.

1 Answer

I believe this link is going to solve all your problems related to saving images and also to showing them in the gridview.

https://github.com/nostra13/Android-Universal-Image-Loader

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.