Buggy code:
public class WorkflowSectionFragment extends Fragment { private static final int INTENT_ENABLE_GPS = 1000 ; private static final int INTENT_ENABLE_NET = 1001 ; private static final int INTENT_RECOVER_FROM_PLAY_SERVICES_ERROR = 1004 ; private static final int INTENT_TAKE_PHOTO = 1005 ; private static final int INTENT_PICK_PHOTO = 1006 ; private static final int INTENT_PICK_AUDIO = 1007 ; private static final int INTENT_PICK_DATA = 1008 ; private static final int INTENT_PICK_VIDEO = 1009 ; private final String LOG_TAG = WorkflowSectionFragment . class . getSimpleName ( ) ; public static final String ARG_SECTION_NUMBER = "section_number" ; private String collectionID = DeviceStatus . collectionID ; private List < DataItem > itemList = new ArrayList < DataItem > ( ) ; private DataItem item = new DataItem ( ) ; private MetaDataLocal meta = new MetaDataLocal ( ) ; private Location currentLocation ; private static Gson gson = new GsonBuilder ( ) . serializeNulls ( ) . excludeFieldsWithoutExposeAnnotation ( ) . create ( ) ; private String filePath ; private String fileName ; private DeviceStatus status ; private View rootView ; private ImageView imageView ; private RatingBar ratingView ; private TextView lblLocation ; private ImageView btnStartLocationUpdates ; private VisualizerView visualizerView ; private AudioRecordingThread recordingThread ; private boolean startRecording = true ; private boolean readyToPlay = false ; private User user ; private MenuItem poi_list ; private FloatingActionButton bottomCenterButton ; private WorkflowSectionFragment . OnLocationUpdatedListener mCallback ; private AudioPlaybackManager playbackManager ; private PlaybackHandler playbackHandler ; public PlaybackHandler getPlaybackHandler ( ) { } public void setPlaybackHandler ( PlaybackHandler playbackHandler ) { } public interface OnLocationUpdatedListener { public void onLocationViewClicked ( ImageView btnStartLocationUpdates ) { } public void replaceFragment ( MetadataFragment fragment ) { } } public RatingBar getRatingView ( ) { } public void setRatingView ( RatingBar ratingView ) { } public TextView getLblLocation ( ) { } public VisualizerView getVisualizerView ( ) { } public void setVisualizerView ( VisualizerView visualizerView ) { } public AudioPlaybackManager getPlaybackManager ( ) { } public void setPlaybackManager ( AudioPlaybackManager playbackManager ) { } public FloatingActionButton getBottomCenterButton ( ) { } public ImageView getBtnStartLocationUpdates ( ) { } @ Override public void onAttach ( Activity activity ) { } public void onCreate ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onStart ( ) { } @ Override public void onResume ( ) { } @ Override public void onPause ( ) { } @ Override public void onStop ( ) { } @ Override public void onDestroy ( ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public boolean onOptionsItemSelected ( MenuItem menuItem ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent data ) { } public void onGetMetadataFromUser ( MetadataIsReadyEvent event ) { } @ Subscribe public void onGetNewLocationFromGPS ( LocationChangedEvent event ) { } private void takePhoto ( ) { } private void createPhotoFile ( ) { } private String getRealPathFromURI ( Uri contentURI ) { String result = null ; <START_BUG> if ( ( VERSION . SDK_INT ) < 19 ) { <END_BUG> Cursor cursor = getActivity ( ) . getContentResolver ( ) . query ( contentURI , null , null , null , null ) ; if ( cursor == null ) { result = contentURI . getPath ( ) ; } else { cursor . moveToFirst ( ) ; int idx = cursor . getColumnIndex ( DATA ) ; result = cursor . getString ( idx ) ; cursor . close ( ) ; } } else { String id = contentURI . getLastPathSegment ( ) . split ( ":" ) [ 1 ] ; final String [ ] imageColumns = new String [ ] { Media . DATA } ; final String imageOrderBy = null ; Uri uri = getUri ( ) ; Cursor imageCursor = getActivity ( ) . getContentResolver ( ) . query ( uri , imageColumns , ( ( ( Media . _ID ) + "=" ) + id ) , null , imageOrderBy ) ; if ( imageCursor . moveToFirst ( ) ) { result = imageCursor . getString ( imageCursor . getColumnIndex ( MediaStore . Images . Media . DATA ) ) ; } Log . v ( "path" , result ) ; } return result ; } private Uri getUri ( ) { } private void addImageToGallery ( String filePath ) { } public String encodeBae64 ( String src ) { } public void showToast ( String message ) { } public void getAddressByCoordinates ( double latitude , double longitude ) { } @ Subscribe public void OnGetAddressEvent ( GetAddressEvent event ) { } private void reSetUpView ( ) { } private void reSetUpAudioView ( ) { } private void setupVisualizer ( ) { } private void releaseVisualizer ( ) { } private void record ( ) { } private void recordStart ( ) { } private void recordStop ( ) { } private void startRecording ( ) { } private void stopRecording ( ) { } No newline ; at end ; of file ; }

Fix:
if ( ( VERSION . SDK_INT ) < 20 ) {