How to switch to another activity using imageview in reycleview?

Viewed 20

So, I am basically building an expense tracker app. I have successfully implemented Recycleview which contains Transactions' history. Now, what I am trying to achieve is to use an arrow imageview in the recycleview which will forward me to another activity when it is clicked. Any help will be appreciated on it.

1 Answers

in your adapter class inside onBindViewHolder method add

holder.img.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
           
            Intent intent = new Intent(context, OtherActivity.class);
            
            context.startActivity(intent);
        }
    });
Related