Android - Making an activity display different things depending on what is clicked
- by user3682017
I have a listview that is populated by an arraylist of classes.
public void populateThingsList(){
listExample.add(new Example("Example name", 1, "Example detail 1", "Example detail 2", R.drawable.1_icon, "Example detail 3"));
listExample.add(new Example("Example name1", 2, "Example detail 1", "Example detail 2", R.drawable.2_icon, "Example detail 3"));
listExample.add(new Example("Example name2", 3, "Example detail 1", "Example detail 2", R.drawable.3_icon, "Example detail 3"));
listExample.add(new Example("Example name3", 4, "Example detail 1", "Example detail 2", R.drawable.4_icon, "Example detail 3"));
listExample.add(new Example("Example name4", 5, "Example detail 1", "Example detail 2", R.drawable.5_icon, "Example detail 3"));
listExample.add(new Example("Example name5", 6, "Example detail 1", "Example detail 2", R.drawable.6_icon, "Example detail 3"));
listExample.add(new Example("Example name6", 7, "Example detail 1", "Example detail 2", R.drawable.7_icon, "Example detail 3"));
listExample.add(new Example("Example name7", 8, "Example detail 1", "Example detail 2", R.drawable.8_icon, "Example detail 3"));
listExample.add(new Example("Example name8", 9, "Example detail 1", "Example detail 2", R.drawable.9_icon, "Example detail 3"));
listExample.add(new Example("Example name9", 10, "Example detail 1", "Example detail 2", R.drawable.10_icon, "Example detail 3"));
}
This is the code for the clicklistener.
ListView list = (ListView) findViewById(R.id.exampleListView);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Example clickedexample = listExample.get(position);
startActivity(new Intent("com.example.app.EXAMPLEACTIVITY"));
}
}
Is there any way I can get the information from clickedExample and set the textViews and imageView in ExampleActivity depending on which one was clicked?