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.