不回收站适配器设置一些数据适配器、回收站、数据

由网友(孤傲白狼)分享简介:这是我的CreateView的。我看到,所有的数据是可用的,但一些数据的是不是在适配器设置的日志猫。平衡卡不是再循环器视图的一部分。这是在一个片段完成的。当此片段的OnCreate观点被称为我得到的错误没有适配器连接;跳绳布局错误。我认为,它希望我只要我初始化回收的看法,但因为我得到的所有数据,因此可能会引发错误,但后...

这是我的CreateView的。我看到,所有的数据是可用的,但一些数据的是不是在适配器设置的日志猫。平衡卡不是再循环器视图的一部分。这是在一个片段完成的。当此片段的OnCreate观点被称为我得到的错误没有适配器连接;跳绳布局错误。我认为,它希望我只要我初始化回收的看法,但因为我得到的所有数据,因此可能会引发错误,但后安装一个适配器还是我不附加一个适配器有没有见过的数据作出解释在一些观点。

This is my on createView. I see in the log cat that all the data is available but some of the data is not set in the adapter. The balance card is not a part of the recycler view. This is done in a fragment. When the oncreate view of this fragment is called i get the error No adapter attached; skipping layout error. I think that it expects me to attach an adapter as soon as i initialize the recycler view but since i am attaching an adapter after getting all the data so it may be throwing the error but still i dont have an explanation for data that is not seen in some view.

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;
        }

推荐答案

这个问题就解决了​​。正是有了Adapter类的地方我打的知名度。感谢名单的帮助

The problem is solved. It was with Adapter class where i played with the VISIBILITY. Thanx for the help

阅读全文

相关推荐

最新文章