LizG LizG - 2 years ago 101
Android Question

Retrieving an image file from and displaying in an image view

I am trying to download the image from and display in a image view in an Activity extending AppCompatActivity.

I got this code from one of many searches:

ParseImageView mImage = (ParseImageView) findViewById(;

ParseObject object = new ParseObject("Appetizers"); // class name
ParseFile postImage = object.getParseFile("imageFiles"); // column name
String imageUrl = postImage.getUrl() ;//live url
Uri imageUri = Uri.parse(imageUrl);


My parse class

Any help would be appreciated.

File format: jpg

Answer Source

I figured it out by debugging and setting logs everywhere ...

In the sending class:

ParseObject po = mAppetizers.get(position); // get position
String ID = po.getObjectId().toString();

Intent intent = new Intent(Appetizer.this, AppetizerRecipe.class);

intent.putExtra("ID", ID);

In the receiver's class:

final ParseImageView mImage = (ParseImageView) findViewById(;
String ID = getIntent().getStringExtra("ID");

        ParseQuery<ParseObject> getimage = new ParseQuery<>("Appetizers");
    getimage.whereEqualTo("ID", ID);
        Log.d("AppetizerRecipe2", "object: " + ID);
    getimage.getInBackground(ID, new GetCallback<ParseObject>() {
        public void done(ParseObject object, ParseException e) {
            if (e == null) {
                Log.v("what is e?", "e = " + e);
                // success
                final ParseFile fileObject = (ParseFile)object.get("imageFiles");
                fileObject.getDataInBackground(new GetDataCallback() {
                    public void done(byte[] data, ParseException e) {
                        if (e == null) {
                            Log.d("test", "We've got data in data.");
                            // use data for something
                            Log.d("test", "Get your image..." + fileObject.getUrl());

                        } else {
                            Log.d("test", "There was a problem downloading the data.");

            } else {
                // fail
                Log.d("test", "Error Message..." + e.getMessage());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download