-3

I have two different listview activities. I want when i click on a list item in activity 1 this data gets transfer to activity 2 & when i click on a list item in activity 2 this data also gets transfer to activity 3. How can i do this programmatically?

Rahul Verma
  • 1
  • 1
  • 2

1 Answers1

0

In your adapter, either create a view where you want the click action and then add the click-listener like:

holder.yourView.setOnClickListener {
    interface.passDataAndLaunchActivity(data)
}

Where the interface will be your view which you can initialize from your activity when you initialize your adapter. In the interface, you can have the method which launches another activity and you can pass the data to it. You can override that method in your activity to launch another activity and pass the data with putExtra to any other activities.

If you want to click the list item you can directly use the click listener on the view holder.

This will do it.

Yash Joshi
  • 557
  • 7
  • 25