0

I want to pass a List of string into another activity and then display it in a ListView using Intent. I fugured out that I have to pass the List as a Array or Serializable.

val intent: Intent = Intent(this,SettingsActivity::class.java)
    intent.putExtra("list",ArrayList<String>(resultsList) )
    startActivity(intent)

But I can't figure out exactly how to get it from the intent and display it in ListView

Gre1234
  • 11
  • 5

1 Answers1

1

There are 2 sections to your question

  1. Passing a list via an intent

  2. Show that list in a Recycler View

  3. To pass the list you can either use the Parcelable/ Serializabl method or use a library like Gson() to serialize and deserialize it Stackover flow answer on passing lists from one activity to another

2.To show that data you would need a Recycler View and show it on the screen Here is an article to get you started

Narendra_Nath
  • 4,578
  • 3
  • 13
  • 31
  • Thanks a lot, do you have any other article about RecycleView, because this one seems to be very good but it has broken pictures in it and they don't sow up – Gre1234 Mar 25 '22 at 22:13
  • https://stackoverflow.com/questions/40584424/simple-android-recyclerview-example Here is a stack overflow article – Narendra_Nath Mar 25 '22 at 22:14
  • https://guides.codepath.com/android/using-the-recyclerview Also this codepath should help – Narendra_Nath Mar 25 '22 at 22:16