public final ArrayList<PositionRecord> loadPositions(final int session,final Double minLat,final Double maxLat,final Double minLon,final Double maxLon){
  final ArrayList<PositionRecord> positions=new ArrayList<>();
  String selection=Schema.COL_SESSION_ID + " = ?";
  Cursor cursor=null;
  List<String> selectionArgs=null;
  if (minLat != null & maxLat != null && minLon != null && maxLon != null) {
    selectionArgs=new ArrayList<>();
    selectionArgs.add(String.valueOf(session));
    selectionArgs.add(String.valueOf(minLat));
    selectionArgs.add(String.valueOf(maxLat));
    selectionArgs.add(String.valueOf(minLon));
    selectionArgs.add(String.valueOf(maxLon));
    selection+="AND (" + Schema.COL_LATITUDE + " > ? AND "+ Schema.COL_LATITUDE+ " < ?) AND ("+ Schema.COL_LONGITUDE+ " > ? AND "+ Schema.COL_LONGITUDE+ " < ?)";
    cursor=contentResolver.query(ContentProvider.CONTENT_URI_POSITION,null,selection,selectionArgs.toArray(new String[0]),Schema.COL_TIMESTAMP);
  }
 else {
    Log.v(TAG,"No boundaries provided, loading all positions");
    cursor=contentResolver.query(ContentProvider.CONTENT_URI_POSITION,null,null,null,Schema.COL_TIMESTAMP);
  }
  while (cursor.moveToNext()) {
    positions.add(positionFromCursor(cursor));
  }
  cursor.close();
  return positions;
}

public final ArrayList < PositionRecord > loadPositions ( final int session , final Double minLat , final Double maxLat , final Double minLon , final Double maxLon ) { final ArrayList < PositionRecord > positions = new ArrayList < > ( ) ; String selection = Schema . COL_SESSION_ID + " = ?" ; Cursor cursor = null ; List < String > selectionArgs = null ; if ( minLat != null & maxLat != null && minLon != null && maxLon != null ) { selectionArgs = new ArrayList < > ( ) ; selectionArgs . add ( String . valueOf ( session ) ) ; selectionArgs . add ( String . valueOf ( minLat ) ) ; selectionArgs . add ( String . valueOf ( maxLat ) ) ; selectionArgs . add ( String . valueOf ( minLon ) ) ; selectionArgs . add ( String . valueOf ( maxLon ) ) ; selection += "AND (" + Schema . COL_LATITUDE + " > ? AND " + Schema . COL_LATITUDE + " < ?) AND (" + Schema . COL_LONGITUDE + " > ? AND " + Schema . COL_LONGITUDE + " < ?)" ; cursor = contentResolver . query ( ContentProvider . CONTENT_URI_POSITION , null , selection , selectionArgs . toArray ( new String [ 0 ] ) , Schema . COL_TIMESTAMP ) ; } else { Log . v ( TAG , "No boundaries provided, loading all positions" ) ; cursor = contentResolver . query ( ContentProvider . CONTENT_URI_POSITION , null , null , null , Schema . COL_TIMESTAMP ) ; } while ( cursor . moveToNext ( ) ) { positions . add ( positionFromCursor ( cursor ) ) ; } cursor . close ( ) ; return positions ; }
loads positions within certain arrea
