简体   繁体   中英

Unable to retrieve images from parse

Please help me solve my problem. I have looked everywhere to try and find a solution. Thank You for trying to help me.

This is my program to retrieve the image from parse.

newPicture = new pictureUpload();
ParseImageView dogPhoto2 = (ParseImageView) findViewById(R.id.imageButton2);
Log.d("test", "after");
dogPhoto1.setVisibility(View.VISIBLE);
ParseFile photoFile = newPicture.getParseFile("photo");
if (photoFile != null) {
    dogPhoto1.setParseFile(photoFile);
    dogPhoto1.loadInBackground(new GetDataCallback() {
        @Override
        public void done(byte[] data, ParseException e) {
            // nothing to do
            Log.d("test", "done");
        }
    });
}

This is my pictureUpload class.

@ParseClassName("pictureUpload")
public class pictureUpload extends ParseObject {

    public pictureUpload() {

    }

    public int getRating() {
        return getInt("rating");
    }

    public void setRating() {
        put("rating", 500);
    }

    public ParseFile getPhotoFile() {
        return getParseFile("photo");
    }

    public void setPhotoFile(ParseFile file) {
        put("photo", file);
    }

}

You're not providing any way to get information from the Parse database.

newPicture = new pictureUpload();
ParseFile photoFile = newPicture.getParseFile("photo");

You need to do a query or get or something to fetch the data. Right now you're trying to get a file from an empty ParseObject.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM