Home > Software engineering >  How to showing response string in a textview?
How to showing response string in a textview?

Time:07-02

Result: {"Status":"OK","Message":"Report Genarated.","Result":"JVBERi0xLjUKJeLjz9MKMSAwIG9iago8PC9UeXBlL0ZvbnQvU3VidHlw"}

I am getting these response from the post api calling.Now How can i am get the Result string value.

Code:

        holder.downloadBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                manager = new UtilityBillManager(context, AppBaseController.get().getUserSettings());
                manager.UserTransactionReceiptReport(listener,billReceiptReport); //This the api calling

            }
        });
    }

    private  final TransactionReportListener listener = new TransactionReportListener() {

        @Override
        public void didFetch(UserReportResponse response, String message) {

        }

        @Override
        public void didError(String message) {

        }
    };

UserReponse is a Model which have String status,message, result.

CodePudding user response:

Just use getResult() getter of Model class See the below code

 // add this condition to prevent app crashing.
if (response.body().getResult()!=null){
                        textView.setText(response.body().getResult()); // getResult() is your getters of the Model Class.
                    }

Hope it helps.

  • Related