I am new to Java and Android and come from PHP background. I am trying to display a list view based on arbitrary data received from a previous activity. This the code that I am using:
String[] chapter_array = getResources().getStringArray(R.array.view_chapter);
setListAdapter(new ArrayAdapter<String>(this, R.layout.view_surah, chapter_array));
How do I change the “view_chapter” in R.array.view_chapter to make it populate the list from the data received from the last activity.
You probably want to write a custom
ListAdapterthat pulls the data out of the Intent passed to the new activity (i.e.getIntent().getExtras()) and feed that data into your customListAdapter.The Android developer docs have a good sample on how to write a
ListAdapter.