简体   繁体   中英

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

  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.

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 :-)

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