Result: {"Status":"OK","Message":"Report Genarated.","Result":"JVBERi0xLjUKJeLjz9MKMSAwIG9iago8PC9UeXBlL0ZvbnQvU3VidHlw"}
我從 post api 呼叫中得到這些回應。現在我怎樣才能得到結果字串值。
代碼:
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 是一個具有字串狀態、訊息、結果的模型。
uj5u.com熱心網友回復:
只需使用getResult()
Model 類的 getter 參見下面的代碼
// 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.
}
希望能幫助到你。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/498362.html
上一篇:使用RestAssured時,如果我發送一個post請求將資料提交到服務器,我該如何故意遺漏json字串中的某些屬性?