Eugene Sukhomlyn
Eugene Sukhomlyn

Reputation: 45

Pass data from RecyclerView element to new activity (Xamarin)

I have RecyclerView and write code to start activity by clicking on element in recycler view

I have this code in Adapter

void OnItemClick(int position)
    {
        _context.StartActivity(new Intent(_context, typeof(Tours_detail)));
    }

I need to pass data to Activity. How I can do this?

For example with PutExtra?

Upvotes: 2

Views: 145

Answers (1)

Patryk Jabłoński
Patryk Jabłoński

Reputation: 747

try to add data into your intent. I think that PutExtra function will do the work for you

var intent = new Intent(_context, typeof(Tours_detail);
intent.PutExtra("name", "value");
_context.StartActivity(intent);

https://developer.xamarin.com/recipes/android/fundamentals/activity/pass_data_between_activity/

Upvotes: 1

Related Questions