为什么数据没有出现在模拟器上的片段中? 我收到错误消息“未连接适配器;正在跳过布局”
onCreateView方法
v = inflater.inflate(R.layout.frag_diagnosawal, container, false);
myRecyclerv = (RecyclerView) v.findViewById(R.id.diagawal_recycler);
myRecyclerv.setLayoutManager(new LinearLayoutManager(getActivity()));
myRecyclerv.setHasFixedSize(true);
return v;
OnCreate
fetchData();
fetchData()
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ApiDatatanya.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
ApiDatatanya request = retrofit.create(ApiDatatanya.class);
Call<List<DataDiagnoseawal>> call = request.getDatas();
call.enqueue(new Callback<List<DataDiagnoseawal>>() {
@Override
public void onResponse(Call<List<DataDiagnoseawal>> call, Response<List<DataDiagnoseawal>> response) {
DataDA = response.body();
myReAdapt = new RecyclerAdaptDiagnoseawal(getContext(),DataDA);
myRecyclerv.setAdapter(myReAdapt);
}
@Override
public void onFailure(Call<List<DataDiagnoseawal>> call, Throwable t) {
Log.d("Eror",t.getMessage());
}
});