I have this code that checks for a value of an extra in an Intent on an Activity that is called from many places in my app:
getIntent().getExtras().getBoolea
getIntent() will return null if there is no Intent so use...
getIntent()
null
Intent
boolean isNewItem = false; Intent i = getIntent(); if (i != null) isNewItem = i.getBooleanExtra("isNewItem", false);