猿问

为什么我无法将数据从 RecyclerView 传递到另一个 RecyclerView

我想让RecyclerView1 Activity1中的数据可以传递给RecyclerView2 Activity2


//SectionAdapter.java


public class AdapterSectionHotTrendingNews extends RecyclerView.Adapter{


private Context mContext;

private ArrayList<ModelSectionHotTrendingNews> modelSectionHotTrendingNews;


public AdapterSectionHotTrendingNews(Context mContext, ArrayList<ModelSectionHotTrendingNews> modelSectionHotTrendingNews) {

    this.mContext = mContext;

    this.modelSectionHotTrendingNews = modelSectionHotTrendingNews;

}


@Override

        public SectionHotTrendingNewsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_section_hottrendingnews, null);

    return new SectionHotTrendingNewsViewHolder(v);

}


@Override

public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {


    final SectionHotTrendingNewsViewHolder sectionHotTrendingNewsViewHolder = (SectionHotTrendingNewsViewHolder) holder;

    ModelSectionHotTrendingNews modelSectionHotTrendingNewsX = modelSectionHotTrendingNews.get(position);


    //Set

    sectionHotTrendingNewsViewHolder.TVSectionTitle.setText(modelSectionHotTrendingNewsX.getHeaderTitle());


    ArrayList singleSectionItems = modelSectionHotTrendingNewsX.getAllItemsInSection();

    /*AdapterSingleHotLatestNews.RecyclerViewClickListener listenerLatestNews;

    listenerLatestNews = new AdapterSingleHotLatestNews.RecyclerViewClickListener() {

        @Override

        public void onRowHotLatestNewsClick(View view, int position) {


        }


        @Override

        public void onIconHotLatestNewsClick(View view, int position) {


        }

    };*/


FFIVE
浏览 99回答 1
1回答

有只小跳蛙

内部TabMoreHotActivity使用是这样的:&nbsp; &nbsp; ArrayList<ModelSingleHotTrendingNews> modelSingleHotTrendingNews = new ArrayList<>();&nbsp;&nbsp; &nbsp; Bundle bundle = getIntent().getExtras();&nbsp; &nbsp; if(bundle!=null {&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; modelSingleHotTrendingNews = ArrayList<ModelSingleHotTrendingNews>) bundle.getSerializable("MoreNews");&nbsp; &nbsp; }
随时随地看视频慕课网APP

相关分类

Java
我要回答