Close the current activity when you only have a reference to Context

Buda Gavril picture Buda Gavril · Mar 21, 2011 · Viewed 66.6k times · Source

If I have a reference to Context, is it possible to finish the current activity?

I don't have the reference to current activity.

Answer

2red13 picture 2red13 · Mar 21, 2011

yes, with a cast:

((Activity) ctx).finish();