我正在尝试检索已从应用程序上载的图像:

intent = getIntent();
    String id = intent.getStringExtra("id");
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Items");
    query.getInBackground(id, new GetCallback<ParseObject>()
    {
        @Override
        public void done(ParseObject object, ParseException e)
        {
            if (e == null)
            {
                setTitle(object.getString("name"));
                textPlatform.setText(object.getString("platform"));
                textPrice.setText(String.valueOf(object.getDouble("price")));
                textDelivery.setText(String.valueOf(object.getDouble("delivery")));
                textLocation.setText(object.getString("location"));
                textCondition.setText(object.getString("condition"));
                textSeller.setText(object.getString("seller"));
                ParseFile applicantResume = (ParseFile) object.get("image");
                applicantResume.getDataInBackground(new GetDataCallback()
                {
                    public void done(byte[] data, ParseException e)
                    {
                        if (e == null)
                        {
                            Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
                            imgItem.setImageBitmap(bmp);
                        }
                        else
                        {
                            e.printStackTrace();
                        }
                    }
                });
            } else
            {
                e.printStackTrace();
            }
        }

    });

我可以成功地检索其他项,而不是文件(我知道它存在并且在“image”列下)。
提前谢谢你

最佳答案

我就是这样做的:
我使用get parse file方法从parse获取文件:

ParseFile postImage = object.getParseFile(ParseConstants.PARSE_KEY_FILE);
String imageUrl = postImage.getUrl() ;//live url
Uri imageUri = Uri.parse(imageUrl);

然后我使用毕加索来显示图像:
Picasso.with(context).load(imageUri.toString()).into(mPostImage);

09-25 16:37
查看更多