How to finish an activity from an Adapter..?

Noby picture Noby · Oct 31, 2011 · Viewed 59.3k times · Source

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

Answer

Yashwanth Kumar picture Yashwanth Kumar · Oct 31, 2011

type cast it with activity.

((Activity)context).finish();