简体   繁体   中英

How to switch to another activity using imageview in reycleview?

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.

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);
        }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM