Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to finish an activity from an Adapter..?

I tried with passing context of activity into the adapter and then i tried context.finish(); But its giving me one error like The method finish() is undefined for the type Context

like image 388
Noby Avatar asked Oct 31 '11 09:10

Noby


People also ask

How do you end an activity in adapter class?

Try passing your Activity as an activity parameter, then you'll be able to call finish() on it. Hope this helps.


1 Answers

type cast it with activity.

((Activity)context).finish(); 
like image 145
Yashwanth Kumar Avatar answered Oct 02 '22 16:10

Yashwanth Kumar