Get Image(Stored as ParseFile) to Android from parse.com using Known
object id
So Basically id is the vriable in which the id of the object I am trying
to access is stored and the Title of the column of the image is img1 which
is a ParseFile. I am getting some kind of syntax error which Eclipse is
not displaying. I am new to Android so if anyone could help out it will be
great ! I have been trying to fix this issue since couple of hours but not
able to do so.
for(String id: idList){
ParseObject p = (ParseObject) p.get(id); ---getting a
syntax error here
ParseFile image = (ParseFile) p.get("IMG");
image.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
// data has the bytes for the resume
} else {
// something went wrong
}
}
});
}
The second alternative which I tried was:
ParseObject ob = null;
ParseQuery query = new ParseQuery (
"IMG");
try {
ob =query.get(id);
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ParseFile image = (ParseFile) ob.get("img1");
image.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
Bitmap bmp = BitmapFactory
.decodeByteArray(data, 0, data.length);
ImageView pic;
pic = (ImageView) findViewById(R.id.imageView3);
pic.setImageBitmap(bmp);
}
If someone can explain me how to exactly use the query and how to access
the ParseFile it will be great ! I have spent enough time on Parse
documentations and have checked out all the related questions as well.
Thanks in advance.
No comments:
Post a Comment