Nitesh Tiwari
Nitesh Tiwari

Reputation: 4762

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.

Upvotes: 1

Views: 519

Answers (1)

Nitesh Tiwari
Nitesh Tiwari

Reputation: 4762

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

Upvotes: 2

Related Questions