Calling startActivity() from outside of an Activity context

Either

  • cache the Context object via constructor in your adapter, or
  • get it from your view.

Or as a last resort,

  • add – FLAG_ACTIVITY_NEW_TASK flag to your intent:

_

myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

Edit – i would avoid setting flags as it will interfere with normal flow of event and history stack.

Leave a Comment