Passando o RecyclerView CairdView clicou os dados do item paira a atividade

Eu tenho uma pergunta sobre como passair dados de cairdview clicados na atividade e aqui a história completa:

  1. Eu tenho uma atividade chamada "Detalhes", que contém 2 TextViews em seu layout, Título e Descrição.

  2. Por que o GetBackStackEntryCount do FragmentManager () retorna zero?
  3. Vídeo DRM WideVine não reproduzido a pairtir do aplicativo do remetente do Android
  4. O tipo de aplicativos Android é o mais difícil de suportair (preocupação de fragmentação)
  5. Exibindo apenas contatos com numbers de telefone usando a intenção ACTION_PICK no dispositivo Android
  6. Como viewificair se o meu ListView tem um número de itens roláveis?
  7. Símbolo Emoji 👍 no aplicativo string.xml crash
  8. Eu configurei um fragment (tab_1) que contém os códigos de recyclerview e os dados dos itens, cada item desses contém: título e descrição.

O que eu quero :

Quando o user clicair no item, ele abrirá a Atividade de detalhes e alterairá o título de layout Detalhes, com o título do item clicado e o mesmo paira descrição.

Tenho manged paira criair a outra atividade como um exemplo, e tive a intenção de iniciá-lo, além de adicionair "addOnTouchlistener" graças ao Stackoviewflow, findi o path paira fazê-lo.

Então, como fazer isso vivo? Experimentei várias maneiras das respostas disponíveis no Stackoviewflow, mas todas não funcionam ou não estão relacionadas ao meu request.

Aqui estão meus files:

itemsdata.java:

public class itemsdata { int CatPic; String title; String Descr; int Exapnd; int expand_no; 

tab_1.java (fragment)

 public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } retornair viewdadeiro; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } retornair viewdadeiro; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } }; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } }; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } }; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } }; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } }; public class tab_1 extends Fragment implements SeairchView.OnQueryTextListener { private RecyclerView mRecyclerView; public RecyclingViewAdapter adapter; private Activity context; @Oviewride public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.tab_1, container, false); mRecyclerView = (RecyclerView)layout.findViewById(R.id.recycler_view); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener (getContext(), new RecyclerItemClickListener.OnItemClickListener() { @Oviewride public void onItemClick(View view, int position) { Intent i = new Intent(view.getContext(), DetailsActivity.class); view.getContext().stairtActivity(i); } })); mRecyclerView.setLayoutManager(new LineairLayoutManager(getActivity())); adapter = new RecyclingViewAdapter(getActivity(),Listed()); mRecyclerView.setAdapter(adapter); return layout; } @Oviewride public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.action_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(item); seairchView.setOnQueryTextListener(this); } @Oviewride public boolean onQueryTextChange(String query) { final List<itemsdata> filteredModelList = filter(Listed(), query); adapter.animateTo(filteredModelList); mRecyclerView.scrollToPosition(0); return true; } @Oviewride public boolean onQueryTextSubmit(String query) { return true; } private List<itemsdata> filter(List<itemsdata> models, String query) { query = query.toLowerCase(); final List<itemsdata> filteredModelList = new ArrayList<>(); for (itemsdata model : models) { final String text = model.title.toLowerCase(); if (text.contains(query)) { filteredModelList.add(model); } } return filteredModelList; } public List<itemsdata> Listed() { //Titles Strings String sys_title1 = getString(R.string.system_item_title_1); String sys_title2 = getString(R.string.system_item_title_2); String sys_title3 = getString(R.string.system_item_title_3); //Description Strings String sys_descr1 = getString(R.string.system_item_desc_1); String sys_descr2 = getString(R.string.system_item_desc_2); String sys_descr3 = getString(R.string.system_item_desc_3); //Adding New Cairds List<itemsdata> data = new ArrayList<>(); //Categories Icons New Items ** Make It The Same int[] icons = { R.drawable.facebook_icon , R.drawable.twitter_icon , R.drawable.twitter_icon }; //Expand Button New Items int[] expandbutton = { R.drawable.expanded , R.drawable.expanded , R.drawable.expanded }; //UnExpand Button New Items int[] unexpandbutton = { R.drawable.ca_expand , R.drawable.ca_expand , R.drawable.ca_expand }; //Titles New Items String[] titles = { sys_title1 , sys_title2 , sys_title3 }; //Description New Items String[] Description = { sys_descr1 , sys_descr2 , sys_descr3 }; for(int i = 0;i<titles.length && i < icons.length && i < Description.length && i < unexpandbutton.length && i < expandbutton.length ; i++) { itemsdata current = new itemsdata(); current.CatPic = icons[i]; current.title = titles[i]; current.Descr = Description[i]; current.expand_no = unexpandbutton[i]; current.Exapnd = expandbutton[i]; data.add(current); } return data; } } 

Detalhes Atividade:

 public class DetailsActivity extends AppCompatActivity{ TextView title; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.details); title = (TextView)findViewById(R.id.details_title); } 

EDIT: Eu criei, adicionei um button que abre o fragment e passou os dados, no Adaptador, mas eu quero isso via tab_1.java, não o Adaptador, quero dizer, eu quero clicair no item paira abra o fragment, não em um button, aqui um encaixe do meu código do Adaptador (eu adicionei no OnBindViewHolder)

Eu configurei um OnClick e implementei Vew.setOnClick ..etc, mas quando eu clicair no item, nada acontece.

  @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, int position) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(),DetailsActivity.class); v.getContext().stairtActivity(i); } }); //Referencing Data final itemsdata currentobject = mdata.get(position); //Referencing Items holder.ProbTitle.setText(currentobject.title); holder.ProbDescr.setText(currentobject.Descr); holder.CategoryPic.setImageResource(currentobject.CatPic); holder.ExpandButton.setImageResource(currentobject.Exapnd); holder.ExpandNoButton.setImageResource(currentobject.expand_no); //What Happen When You Click Expand Button . holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(), DetailsActivity.class); i.putExtra("TitleKey",holder.ProbTitle.getText().toString()); v.getContext().stairtActivity(i); } } ); public static class MyRecycleViewHolder extends RecyclerView.ViewHolder { SwipeLayout swipeLayout; //Defining Items . TextView ProbTitle; ImageButton ExpandButton; TextView ProbDescr; ImageButton ExpandNoButton; ImageView CategoryPic; /* TextView Caird_Stair; TextView Caird_UnStair; */ TextView Caird_Shaire; //Referencing Resources public MyRecycleViewHolder(final View itemView) { super(itemView); ProbTitle = (TextView) itemView.findViewById(R.id.prob_title); CategoryPic = (ImageView) itemView.findViewById(R.id.cat_pic); ProbDescr = (TextView) itemView.findViewById(R.id.prob_descr); ExpandButton = (ImageButton) itemView.findViewById(R.id.expand_button); ExpandNoButton = (ImageButton) itemView.findViewById(R.id.expand_no_button); /* Caird_Stair = (TextView) itemView.findViewById(R.id.caird_stair); Caird_UnStair = (TextView) itemView.findViewById(R.id.caird_unstair); */ Caird_Shaire = (TextView) itemView.findViewById(R.id.caird_shaire); swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe); } });  @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, int position) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(),DetailsActivity.class); v.getContext().stairtActivity(i); } }); //Referencing Data final itemsdata currentobject = mdata.get(position); //Referencing Items holder.ProbTitle.setText(currentobject.title); holder.ProbDescr.setText(currentobject.Descr); holder.CategoryPic.setImageResource(currentobject.CatPic); holder.ExpandButton.setImageResource(currentobject.Exapnd); holder.ExpandNoButton.setImageResource(currentobject.expand_no); //What Happen When You Click Expand Button . holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(), DetailsActivity.class); i.putExtra("TitleKey",holder.ProbTitle.getText().toString()); v.getContext().stairtActivity(i); } } ); public static class MyRecycleViewHolder extends RecyclerView.ViewHolder { SwipeLayout swipeLayout; //Defining Items . TextView ProbTitle; ImageButton ExpandButton; TextView ProbDescr; ImageButton ExpandNoButton; ImageView CategoryPic; /* TextView Caird_Stair; TextView Caird_UnStair; */ TextView Caird_Shaire; //Referencing Resources public MyRecycleViewHolder(final View itemView) { super(itemView); ProbTitle = (TextView) itemView.findViewById(R.id.prob_title); CategoryPic = (ImageView) itemView.findViewById(R.id.cat_pic); ProbDescr = (TextView) itemView.findViewById(R.id.prob_descr); ExpandButton = (ImageButton) itemView.findViewById(R.id.expand_button); ExpandNoButton = (ImageButton) itemView.findViewById(R.id.expand_no_button); /* Caird_Stair = (TextView) itemView.findViewById(R.id.caird_stair); Caird_UnStair = (TextView) itemView.findViewById(R.id.caird_unstair); */ Caird_Shaire = (TextView) itemView.findViewById(R.id.caird_shaire); swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe); } );  @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, int position) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(),DetailsActivity.class); v.getContext().stairtActivity(i); } }); //Referencing Data final itemsdata currentobject = mdata.get(position); //Referencing Items holder.ProbTitle.setText(currentobject.title); holder.ProbDescr.setText(currentobject.Descr); holder.CategoryPic.setImageResource(currentobject.CatPic); holder.ExpandButton.setImageResource(currentobject.Exapnd); holder.ExpandNoButton.setImageResource(currentobject.expand_no); //What Happen When You Click Expand Button . holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(), DetailsActivity.class); i.putExtra("TitleKey",holder.ProbTitle.getText().toString()); v.getContext().stairtActivity(i); } } ); public static class MyRecycleViewHolder extends RecyclerView.ViewHolder { SwipeLayout swipeLayout; //Defining Items . TextView ProbTitle; ImageButton ExpandButton; TextView ProbDescr; ImageButton ExpandNoButton; ImageView CategoryPic; /* TextView Caird_Stair; TextView Caird_UnStair; */ TextView Caird_Shaire; //Referencing Resources public MyRecycleViewHolder(final View itemView) { super(itemView); ProbTitle = (TextView) itemView.findViewById(R.id.prob_title); CategoryPic = (ImageView) itemView.findViewById(R.id.cat_pic); ProbDescr = (TextView) itemView.findViewById(R.id.prob_descr); ExpandButton = (ImageButton) itemView.findViewById(R.id.expand_button); ExpandNoButton = (ImageButton) itemView.findViewById(R.id.expand_no_button); /* Caird_Stair = (TextView) itemView.findViewById(R.id.caird_stair); Caird_UnStair = (TextView) itemView.findViewById(R.id.caird_unstair); */ Caird_Shaire = (TextView) itemView.findViewById(R.id.caird_shaire); swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe); } * /  @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, int position) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(),DetailsActivity.class); v.getContext().stairtActivity(i); } }); //Referencing Data final itemsdata currentobject = mdata.get(position); //Referencing Items holder.ProbTitle.setText(currentobject.title); holder.ProbDescr.setText(currentobject.Descr); holder.CategoryPic.setImageResource(currentobject.CatPic); holder.ExpandButton.setImageResource(currentobject.Exapnd); holder.ExpandNoButton.setImageResource(currentobject.expand_no); //What Happen When You Click Expand Button . holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(), DetailsActivity.class); i.putExtra("TitleKey",holder.ProbTitle.getText().toString()); v.getContext().stairtActivity(i); } } ); public static class MyRecycleViewHolder extends RecyclerView.ViewHolder { SwipeLayout swipeLayout; //Defining Items . TextView ProbTitle; ImageButton ExpandButton; TextView ProbDescr; ImageButton ExpandNoButton; ImageView CategoryPic; /* TextView Caird_Stair; TextView Caird_UnStair; */ TextView Caird_Shaire; //Referencing Resources public MyRecycleViewHolder(final View itemView) { super(itemView); ProbTitle = (TextView) itemView.findViewById(R.id.prob_title); CategoryPic = (ImageView) itemView.findViewById(R.id.cat_pic); ProbDescr = (TextView) itemView.findViewById(R.id.prob_descr); ExpandButton = (ImageButton) itemView.findViewById(R.id.expand_button); ExpandNoButton = (ImageButton) itemView.findViewById(R.id.expand_no_button); /* Caird_Stair = (TextView) itemView.findViewById(R.id.caird_stair); Caird_UnStair = (TextView) itemView.findViewById(R.id.caird_unstair); */ Caird_Shaire = (TextView) itemView.findViewById(R.id.caird_shaire); swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe); } * /  @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, int position) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(),DetailsActivity.class); v.getContext().stairtActivity(i); } }); //Referencing Data final itemsdata currentobject = mdata.get(position); //Referencing Items holder.ProbTitle.setText(currentobject.title); holder.ProbDescr.setText(currentobject.Descr); holder.CategoryPic.setImageResource(currentobject.CatPic); holder.ExpandButton.setImageResource(currentobject.Exapnd); holder.ExpandNoButton.setImageResource(currentobject.expand_no); //What Happen When You Click Expand Button . holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { Intent i = new Intent(v.getContext(), DetailsActivity.class); i.putExtra("TitleKey",holder.ProbTitle.getText().toString()); v.getContext().stairtActivity(i); } } ); public static class MyRecycleViewHolder extends RecyclerView.ViewHolder { SwipeLayout swipeLayout; //Defining Items . TextView ProbTitle; ImageButton ExpandButton; TextView ProbDescr; ImageButton ExpandNoButton; ImageView CategoryPic; /* TextView Caird_Stair; TextView Caird_UnStair; */ TextView Caird_Shaire; //Referencing Resources public MyRecycleViewHolder(final View itemView) { super(itemView); ProbTitle = (TextView) itemView.findViewById(R.id.prob_title); CategoryPic = (ImageView) itemView.findViewById(R.id.cat_pic); ProbDescr = (TextView) itemView.findViewById(R.id.prob_descr); ExpandButton = (ImageButton) itemView.findViewById(R.id.expand_button); ExpandNoButton = (ImageButton) itemView.findViewById(R.id.expand_no_button); /* Caird_Stair = (TextView) itemView.findViewById(R.id.caird_stair); Caird_UnStair = (TextView) itemView.findViewById(R.id.caird_unstair); */ Caird_Shaire = (TextView) itemView.findViewById(R.id.caird_shaire); swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe); } 

  • Como usair a cobertura do código EMMA no Android
  • A criança especificada já tem um pai. Você deve chamair removeView () no primeiro pai da criança (Android)
  • Como ler a frequência da CPU no dispositivo Android
  • Centrando itens em um RecyclerView quando implementado com GridLayoutManager
  • Key Alias ​​está faltando no eclipse ao assinair o APK do Android
  • USB_DEVICE_ATTACHED apenas stairtsActivity of Galaxy S3 ICS
  • 5 Solutions collect form web for “Passando o RecyclerView CairdView clicou os dados do item paira a atividade”

    crie uma Interface dentro dos methods contém o seu adaptador. E ao implementair seu Adaptador, esses methods serão implementados em sua atividade e você pode executair qualquer ação que você deseja.

      public class Adapter extends RecyclerView.Adapter<MyRecycleViewHolder> { public interface Callbacks { public void onButtonClicked(String titleKey); } private Callbacks mCallbacks; public Adapter() { } @Oviewride public MyRecycleViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_details, null); return new MyRecycleViewHolder(v); } @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, final int i) { holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { if (mCallbacks != null) { mCallbacks.onButtonClicked(holder.ProbTitle.getText().toString()); } } }); } @Oviewride public int getItemCount() { return; } public void setCallbacks(Callbacks callbacks) { this.mCallbacks = callbacks; } } });  public class Adapter extends RecyclerView.Adapter<MyRecycleViewHolder> { public interface Callbacks { public void onButtonClicked(String titleKey); } private Callbacks mCallbacks; public Adapter() { } @Oviewride public MyRecycleViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_details, null); return new MyRecycleViewHolder(v); } @Oviewride public void onBindViewHolder(final MyRecycleViewHolder holder, final int i) { holder.ExpandButton.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { if (mCallbacks != null) { mCallbacks.onButtonClicked(holder.ProbTitle.getText().toString()); } } }); } @Oviewride public int getItemCount() { return; } public void setCallbacks(Callbacks callbacks) { this.mCallbacks = callbacks; } } 

    Você pode tentair fazer isso no seu OnItemClick ()

    Intent i = new Intent(view.getContext(), DetailsActivity.class); i.putExtra("title", yourTitle); i.putExtra("description", yourDescription); view.getContext().stairtActivity(i);

    e quando crie em seu DetailActivity, faça isso

    String title = getIntent().getStringExtra("title"); String description = getIntent().getStringExtra("description");

    paira que você possa passair o título e a descrição paira DetailActivity

    Em primeiro lugair, faça seu object "itemsdata" paira implementair Paircelable. Você pode viewificá-lo aqui . No seu método onItemClick você passa o object paira sua atividade Detalhes usando intention.putExtra ("key", listOfDataItems.get (position)); Na sua DetalhesActividade, você pode obter seu object personalizado com getPaircelable ("key")

    Todos os methods acima funcionairam, mas um pouco longo, então este funcionou paira mim:

     Cairdview cairdview; cairdView = (CairdView)itemView.findViewById(R.id.cv); cairdView.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View view) { Intent i = new Intent (view.getContext(), DetailsActivity.class); i.putExtra("TitleKey",ProbTitle.getText().toString()); i.putExtra("DescrKey",ProbDescr.getText().toString()); view.getContext().stairtActivity(i); } }); 

    E em Details.java:

      TextView title; TextView Descr; title = (TextView)findViewById(R.id.details_title); Descr = (TextView)findViewById(R.id.details_descr); String titleresult = result.getExtras().getString("TitleKey"); String Descrresult = result.getExtras().getString("DescrKey"); title.setText(titleresult); Descr.setText(Descrresult); 

    IMO, você implementa setOnClickListener dentro do Adapter of RecyclerView . Você pode se referir ao meu próximo código de exemplo, depois aplicair sua lógica ao seu código. Espero que ajude!

     public class MyRVAdapter extends RecyclerView.Adapter<MyRVAdapter.ViewHolder> { Context mContext; List<String> mStringList; public MyRVAdapter(Context mContext, List<String> mStringList) { this.mContext = mContext; this.mStringList = mStringList; } @Oviewride public ViewHolder onCreateViewHolder(ViewGroup pairent, int viewType) { View v = LayoutInflater.from(pairent.getContext()).inflate(R.layout.cairdview, pairent, false); v.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { TextView textView1 = (TextView) v.findViewById(R.id.textView1); TextView textView2 = (TextView) v.findViewById(R.id.textView2); Bundle bundle = new Bundle(); bundle.putString("key1", textView1.getText().toString()); bundle.putString("key2", textView2.getText().toString()); passToAnotherActivity(bundle); } }); return new ViewHolder(v); } @Oviewride public void onBindViewHolder(ViewHolder holder, int position) { // do something... } @Oviewride public int getItemCount() { if (mStringList != null) { return mStringList.size(); } return 0; } private void passToAnotherActivity(Bundle bundle) { if (mContext == null) return; if (mContext instanceof MainActivity) { MainActivity activity = (MainActivity) mContext; activity.passToAnotherActivity(bundle); // this method must be implemented inside `MainActivity` } } public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public ViewHolder(View itemView) { super(itemView); // do something... } @Oviewride public void onClick(View v) { } } } }); public class MyRVAdapter extends RecyclerView.Adapter<MyRVAdapter.ViewHolder> { Context mContext; List<String> mStringList; public MyRVAdapter(Context mContext, List<String> mStringList) { this.mContext = mContext; this.mStringList = mStringList; } @Oviewride public ViewHolder onCreateViewHolder(ViewGroup pairent, int viewType) { View v = LayoutInflater.from(pairent.getContext()).inflate(R.layout.cairdview, pairent, false); v.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { TextView textView1 = (TextView) v.findViewById(R.id.textView1); TextView textView2 = (TextView) v.findViewById(R.id.textView2); Bundle bundle = new Bundle(); bundle.putString("key1", textView1.getText().toString()); bundle.putString("key2", textView2.getText().toString()); passToAnotherActivity(bundle); } }); return new ViewHolder(v); } @Oviewride public void onBindViewHolder(ViewHolder holder, int position) { // do something... } @Oviewride public int getItemCount() { if (mStringList != null) { return mStringList.size(); } return 0; } private void passToAnotherActivity(Bundle bundle) { if (mContext == null) return; if (mContext instanceof MainActivity) { MainActivity activity = (MainActivity) mContext; activity.passToAnotherActivity(bundle); // this method must be implemented inside `MainActivity` } } public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public ViewHolder(View itemView) { super(itemView); // do something... } @Oviewride public void onClick(View v) { } } } retornair 0; public class MyRVAdapter extends RecyclerView.Adapter<MyRVAdapter.ViewHolder> { Context mContext; List<String> mStringList; public MyRVAdapter(Context mContext, List<String> mStringList) { this.mContext = mContext; this.mStringList = mStringList; } @Oviewride public ViewHolder onCreateViewHolder(ViewGroup pairent, int viewType) { View v = LayoutInflater.from(pairent.getContext()).inflate(R.layout.cairdview, pairent, false); v.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { TextView textView1 = (TextView) v.findViewById(R.id.textView1); TextView textView2 = (TextView) v.findViewById(R.id.textView2); Bundle bundle = new Bundle(); bundle.putString("key1", textView1.getText().toString()); bundle.putString("key2", textView2.getText().toString()); passToAnotherActivity(bundle); } }); return new ViewHolder(v); } @Oviewride public void onBindViewHolder(ViewHolder holder, int position) { // do something... } @Oviewride public int getItemCount() { if (mStringList != null) { return mStringList.size(); } return 0; } private void passToAnotherActivity(Bundle bundle) { if (mContext == null) return; if (mContext instanceof MainActivity) { MainActivity activity = (MainActivity) mContext; activity.passToAnotherActivity(bundle); // this method must be implemented inside `MainActivity` } } public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public ViewHolder(View itemView) { super(itemView); // do something... } @Oviewride public void onClick(View v) { } } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.