我有两个片段,叫做MedListFragment和MedDetailFragment。在MedListFragment中,有一个列表视图,其中包含药物项对象。fragmentTransaction.replace(R.id.fragment_container, new MedDetailFragment());
中从一个RecyclerAdapter中添加对象,并且我已经编写了一个函数,用于在adapter.And中获取数组列表,每当我试图将数组列表从MainActivity传递到它给NullPointer(Null值)的片段时,我就会从MainActivity.But中获得数组列表。int id = item.getItemId();