Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 改装解析表单操作并在webview中显示它_Android_Retrofit_Retrofit2 - Fatal编程技术网

Android 改装解析表单操作并在webview中显示它

Android 改装解析表单操作并在webview中显示它,android,retrofit,retrofit2,Android,Retrofit,Retrofit2,我知道如何调用web服务,但是 我显然不知道如何解析它并将其放在webview中: 我目前正在使用翻新 @GET(TOPUP_CREDITCARD+"/{id}"+"/{amount}") Call<BaseResponse> topUpCreditCard(@Path("id") String id, @Path("amount") String amount); @GET(充值信用卡+“/{id}”+“/{amount}”) 调用topUpCreditCard(@Path(“i

我知道如何调用web服务,但是 我显然不知道如何解析它并将其放在webview中:

我目前正在使用翻新

@GET(TOPUP_CREDITCARD+"/{id}"+"/{amount}")
Call<BaseResponse> topUpCreditCard(@Path("id") String id, @Path("amount") String amount);
@GET(充值信用卡+“/{id}”+“/{amount}”)
调用topUpCreditCard(@Path(“id”)字符串id,@Path(“amount”)字符串amount);

更新:我不能解析数据,我不知道。 答复如下:

java.lang.IllegalStateException:应为BEGIN_对象,但为字符串 在第1行第1列路径$

我有这样一个代码:

 final Call<BaseResponse> call = client.topUpCreditCard(SharePreferences.getUserId(context),"10");
                call.enqueue(new Callback<BaseResponse>() {
                    @Override
                    public void onResponse(Call<BaseResponse> call, Response<BaseResponse> response) {
                        if (listener != null) {
                            listener.onProgressDismiss(response.message(), false);
                        }
                        if (response.isSuccessful()) {
                            if (response.body() != null) {
                                if (response.body().status == UriConstants.SUCCESSFULLY) {
                                 Log.d("RESPONSE:",""+response.message());
                                 //TODO ADDED LINIENT IN THE SERVICE, CHECK IF MIGHT EFFECT OTHER WS CALL
                                 listener.onResult(response.message());//    Log.d("RESPONSE:",""+response.body().message);

                                }
                            }
                        }
                    }

                    @Override
                    public void onFailure(Call<BaseResponse> call, Throwable t) {
                        Log.d("RESPONSE:",""+t.getMessage());
                    }
                });
    }
final Call=client.topUpCreditCard(SharePreferences.getUserId(上下文),“10”);
call.enqueue(新回调(){
@凌驾
公共void onResponse(调用、响应){
if(侦听器!=null){
listener.onProgressDisclose(response.message(),false);
}
if(response.issusccessful()){
if(response.body()!=null){
if(response.body().status==UriConstants.SUCCESSFULLY){
Log.d(“响应:”,“+RESPONSE.message());
//TODO在服务中添加了linent,请检查是否可能影响其他WS-CALL
listener.onResult(response.message());//Log.d(“response:”,“+response.body().message”);
}
}
}
}
@凌驾
失败时公共无效(调用调用,可丢弃的t){
Log.d(“响应:”,“+t.getMessage());
}
});
}
试试这个

 WebView wv = (WebView) findViewById(R.id.WebView01);        

            final String mimeType = "text/html";
            final String encoding = "UTF-8";
            String html = "your response";


            wv.loadDataWithBaseURL("", html, mimeType, encoding, "");

请您的后端开发人员用JSON(RESTAPI)而不是HTMLH提供响应。他说我应该在webview/浏览器中显示此响应,您不需要解析它。按原样(字符串形式)将其加载到WebView@VladyslavMatviienko我只是直接将其加载到WebView?因为响应是HTML,而WebView是为HTML设计的-yestried this,不起作用。加载后,我的webview不会发生任何变化。