I am working with recyclerview but I am trying to intent to next activity but there is not setonlistitem method can any one tell how to redirect to next activity on click of list item,following is my snippet code can any one help me with that
public class SubcategoryActivity extends AppCompatActivity{
private Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.subcatgory_listviews);
mToolbar = (Toolbar) findViewById(R.id.toolbarsubcategory_list);
setSupportActionBar(mToolbar);
setTitle(getString(R.string.app_name));
mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerViewsubcategory);
ItemData itemsData[] = { new ItemData("Help",R.drawable.logo),
new ItemData("Delete",R.drawable.logo),
new ItemData("Cloud",R.drawable.logo),
new ItemData("Favorite",R.drawable.logo),
new ItemData("Like",R.drawable.logo),
new ItemData("Rating",R.drawable.logo)};
recyclerView.setLayoutManager(new LinearLayoutManager(this));
MyAdapter mAdapter = new MyAdapter(itemsData);
recyclerView.setAdapter(mAdapter);
recyclerView.setItemAnimator(new DefaultItemAnimator());
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
}