0
I’m developing an app, and it has recyclerView
conjugated with CardView
.
And all the information is stored within the app itself to be presented on recyclerView
.
One part of the structure is this:
Album a = new Album("True Romance", 13, covers[0]);
albumList.add(a);
a = new Album("Xscpae", 8, covers[1]);
albumList.add(a);
a = new Album("Maroon 5", 11, covers[2]);
albumList.add(a);
a = new Album("Born to Die", 12, covers[3]);
albumList.add(a);
a = new Album("Honeymoon", 14, covers[4]);
albumList.add(a);
a = new Album("I Need a Doctor", 1, covers[5]);
albumList.add(a);
a = new Album("Loud", 11, covers[6]);
albumList.add(a);
a = new Album("Legend", 14, covers[7]);
albumList.add(a);
a = new Album("Hello", 11, covers[8]);
albumList.add(a);
a = new Album("Greatest Hits", 17, covers[9]);
albumList.add(a);
adapter.notifyDataSetChanged();
}
And onClick comes right after:
recyclerView.addOnItemTouchListener(
new RecyclerItemClickListener(context, new RecyclerItemClickListener.OnItemClickListener() {
@Override public void onItemClick(View view, int position) {
// TODO Handle item click
}
})
);
How do I adapt each item with a different click? For example:
Clicked on "True Romance" go to a new activity, "Xscpae" go to another activity...
What is the logic? I can do this?
What is the need to go to a different screen? Wouldn’t it be easier to have a single screen that receives the data and then there values the text and etc with the data? If the screen really needs to be different, you can still pass a parameter in onclick and go to a fixed screen and on that screen you read this parameter and gives a setContentView in a different layout for each different parameter. But I point out the first option.
– Mr_Anderson
Hello, thank you for answering. In this case, the basic information is displayed in this recyclerView. Really I need to send to a new screen, because there will be different interactions. Nothing fixed.
– Tech Positivo