简体   繁体   English

从quickblox android下载图像

[英]download image from quickblox android

Hi I'm trying to download the image which I have upload in the Custom Object from the dashboard. 嗨,我正在尝试从仪表板上下载自定义对象中上传的图像。 uid is the id I'm getting on fetching that custom Object uid是我要获取该自定义对象的ID

  QBContent.downloadFile(uid, new QBEntityCallbackImpl<InputStream>(){
            @Override
            public void onSuccess(InputStream inputStream, Bundle params) {

                Bitmap bitmap = BitmapFactory.decodeStream(inputStream);

                if (bitmap != null) {
                    bankImage.setImageBitmap(bitmap);
                }else {
                    bankImage.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.blue));
                }
            }

            @Override
            public void onError(List<String> errors) {


                for (String error: errors){
                    Log.d(TAG , "--errors-"+error);
                }

            }
        }, new QBProgressCallback() {
            @Override
            public void onProgressUpdate(int progress) {

            }
        });

Getting this error: 收到此错误:

Entity you are looking for was not found 找不到您要寻找的实体

Any Help is highly Appreciated. 非常感谢任何帮助。

I was trying to fetch From Content rather that from Custom where I have uploaded the image. 我试图从Content而不是从上载图像的Custom中获取。

Here's the code if any-one land up here: 如果有人在这里,下面是代码:

QBCustomObject qbCustomObject = new QBCustomObject("Your_Class_Name", "Custom_Object_Id");

            QBCustomObjectsFiles.downloadFile(qbCustomObject, "YOUR_FIELD_TO_FETCH", new QBEntityCallbackImpl<InputStream>() {
                @Override
                public void onSuccess() {
                    super.onSuccess();
                }

                @Override
                public void onSuccess(final InputStream result, Bundle params) {
                    super.onSuccess(result, params);

                    Log.d(TAG, "successFull--bitmap");
                }

                @Override
                public void onError(List<String> errors) {
                    super.onError(errors);
                }
            }, new QBProgressCallback() {
                @Override
                public void onProgressUpdate(int i) {
                }
            });

Bingo that's it :-) 宾果游戏就是这样:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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