有人能帮助我吗? ,textview不显示数据..此时,我只是试图从localhost中的json文件中获取数据
现在我做的时候
`Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ROOT_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
RestAPI service = retrofit.create(RestAPI.class);
Call<Models> call = service.getDataQuest();
call.enqueue(new Callback<Models>() { //Asyncronous Request
@Override
public void onResponse(Call<Models> call, Response<Models> response) {
try {
loading.dismiss();
Models m = response.body();
String q = m.getQuestion().get(0).getIsiP();
String q1 = m.getQuestion().get(1).getIsiP();
String q2 = m.getQuestion().get(3).getIsiP();
String q3 = m.getQuestion().get(4).getIsiP();
tv1.setText(q);
tv2.setText(q1);
tv3.setText(q2);
tv4.setText(q3);
}catch (Exception e){
e.printStackTrace();
}
}
}
);
}`
API
public interface RestAPI {
@GET("survey.json")
Call<Models> getDataQuest();}