0
這是我在createView上的。我在日誌中看到所有的數據都可用,但一些數據沒有在適配器中設置。餘額卡不是回收商視圖的一部分。這是在一個片段中完成的。當這個片段的oncreate視圖被稱爲我得到錯誤沒有適配器連接;跳過佈局錯誤。我認爲當我初始化回收站視圖時,我希望附加一個適配器,但是因爲我在獲取所有數據後連接了一個適配器,所以它可能會拋出錯誤,但我仍然沒有解釋沒有看到的數據在一些看法。某些數據未由Recycler Adapter設置
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.payment,null);
currentBalance = (TextView) rootView.findViewById(R.id.current_balance);
paymentsRecyclerView = (RecyclerView) rootView.findViewById(R.id.payments_recycler_view);
Constants.paymentsData = new ArrayList<PaymentsData>();
paymentsRecyclerView.setHasFixedSize(true);
paymentsLayoutManager = new LinearLayoutManager(getActivity());
paymentsRecyclerView.setLayoutManager(paymentsLayoutManager);
new FetchPaymentAsyncTask(getActivity().getApplicationContext(),new FetchPaymentAsyncTask.FetchPaymentCallback() {
@Override
public void onStart(boolean a) {
dialog = new ProgressDialog(getActivity());
dialog.setTitle("Getting Your Payment Details");
dialog.setMessage("Loading... please wait");
dialog.show();
dialog.setCancelable(false);
}
@Override
public void onResult(boolean b) {
if(b){
dialog.dismiss();
currentBalance.setText(getActivity().getApplicationContext().getString(R.string.Rs)+" "+Constants.currentBalance);
paymentsAdapter = new PaymentsAdapter(Constants.paymentsData, getActivity().getApplicationContext());
paymentsRecyclerView.setAdapter(paymentsAdapter);
}
else{
dialog.dismiss();
AlertDialog builder = new AlertDialog.Builder(getActivity()).create();
builder.setTitle("Payment Details");
builder.setMessage("No Payment Records");
builder.show();
}
}
}).execute(Constants.fetchPaymentURL+Constants.merchantId);
return rootView;
}
如果您找到解決方案,請讓您的答案正確。 –
謝謝你的建議。 –