public void selectNewPhoto(){
  removeFromCache();
  final Intent intent=new Intent();
  if (Build.VERSION.SDK_INT < 19) {
    intent.setAction(Intent.ACTION_GET_CONTENT);
  }
 else {
    intent.setAction("android.intent.action.OPEN_DOCUMENT");
    intent.addCategory(Intent.CATEGORY_OPENABLE);
  }
  intent.setType("image/*");
  startActivityForResult(intent,NEW_PHOTO);
}

public void selectNewPhoto ( ) { removeFromCache ( ) ; final Intent intent = new Intent ( ) ; if ( Build . VERSION . SDK_INT < 19 ) { intent . setAction ( Intent . ACTION_GET_CONTENT ) ; } else { intent . setAction ( "android.intent.action.OPEN_DOCUMENT" ) ; intent . addCategory ( Intent . CATEGORY_OPENABLE ) ; } intent . setType ( "image/*" ) ; startActivityForResult ( intent , NEW_PHOTO ) ; }
starts an activity for result that returns an image from the gallery .
