0

这是我的购买项目的数据库结构 在此处输入图像描述

这是我的图像表 在此处输入图像描述

我想获取文件FFNglxekCv

ParseQuery<ParseObject> query = ParseQuery.getQuery(KEY_MASTER_PURCHASED_ITEM);
    ParseUser currentUser = ParseUser.getCurrentUser();


    user.setObjectId(currentUser.getObjectId());*/

    query.whereEqualTo(KEY_PURCHASED_BY, currentUser);
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> parseObjectList, ParseException e) {
            hideProgressDialog();
            if (e == null) {

                if (!parseObjectList.isEmpty()) {

                    for (int i = 0; i < parseObjectList.size(); i++) {

                        ParseObject parseObject = parseObjectList.get(i);

                     // ParseFile parseFile =(ParseFile) parseObject.getParseFile("image");


                        Log.e(TAG,TAG);
                    }
                }

            } else {
                if (!e.getLocalizedMessage().equalsIgnoreCase(""))
                    showErrorToast(e.getLocalizedMessage(), true);
                else
                    showErrorToast(getString(R.string.no_response_from_server), true);
                Log.d(TAG, "Error: " + e.getMessage());
            }
        }
    });

我不知道如何从 parse.com 获取图像

4

1 回答 1

1

我正在使用 Back4App!你能试试下面的东西吗?

ParseQuery<ParseObject> query = ParseQuery.getQuery("Photo");
        query.whereEqualTo("objectId", FFNglxekCv);
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> objects, ParseException e) {
                if(e==null){
                    for(ParseObject object : objects){
                        ParseFile file = (ParseFile) object.get("image");
                        file.getDataInBackground(new GetDataCallback() {
                            @Override
                            public void done(byte[] data, ParseException e) {
                                if(e==null){
                                    Bitmap bitmapImage = BitmapFactory.decodeByteArray(data, 0, data.length);
                                    ImageView image = new ImageView(getApplicationContext());
                                    image.setImageBitmap(bitmapImage);
                                    relativeLayout.addView(image);
                                }
                                else{
                                    Log.i("info", e.getMessage());
                                }
                            }
                        });
                    }
                }
                else{
                    Log.i("info", e.getMessage());
                }
            }
        });

让我知道它是否对你有用!

于 2018-08-16T15:17:26.240 回答