Buggy code:
public class ViewAvailable extends AppCompatActivity implements LocationListener { ListView listView ; ArrayList < String > usersNames = new ArrayList < String > ( ) ; ArrayList < String > actualNames = new ArrayList < String > ( ) ; ArrayList < Location > usersLocations = new ArrayList < Location > ( ) ; ArrayList < String > distances = new ArrayList < String > ( ) ; ArrayAdapter arrayAdapter ; LocationManager locationManager ; String provider ; Location usersCurrentLocation ; boolean requestActive = false ; SharedPreferences sharedPreferences ; String downloadTaskType = "" ; public class DownloadTask extends AsyncTask < String , Void , Void > { boolean resultGood = false ; @ Override protected Void doInBackground ( String ... params ) { if ( downloadTaskType . equals ( "updateLocation" ) ) { try { CloudQuery putDriverLocation = new CloudQuery ( "User" ) ; putDriverLocation . equalTo ( "username" , sharedPreferences . getString ( "currentUser" , "" ) ) ; putDriverLocation . find ( new CloudObjectArrayCallback ( ) { @ Override public void done ( CloudObject [ ] x , CloudException t ) throws CloudException { if ( x != null ) { for ( CloudObject object : x ) { String myBearing = String . valueOf ( usersCurrentLocation . getBearing ( ) ) ; CloudGeoPoint location = new CloudGeoPoint ( usersCurrentLocation . getLatitude ( ) , usersCurrentLocation . getLongitude ( ) ) ; object . set ( "location" , location ) ; object . set ( "bearing" , myBearing ) ; object . save ( new CloudObjectCallback ( ) { @ Override public void done ( CloudObject x , CloudException t ) throws CloudException { } } ) ; } } else { t . printStackTrace ( ) ; } } } ) ; final Location driverLocation = new Location ( provider ) ; driverLocation . setLatitude ( usersCurrentLocation . getLatitude ( ) ) ; driverLocation . setLongitude ( usersCurrentLocation . getLongitude ( ) ) ; CloudQuery query1 = new CloudQuery ( "Requests" ) ; query1 . equalTo ( "driverUsername" , null ) ; CloudQuery query2 = new CloudQuery ( "Requests" ) ; query2 . equalTo ( "driverUsername" , "" ) ; CloudQuery query = CloudQuery . or ( query1 , query2 ) ; <START_BUG> query . orderByAsc ( "reqLocation" ) ; <END_BUG> query . setLimit ( 10 ) ; query . find ( new CloudObjectArrayCallback ( ) { @ Override public void done ( CloudObject [ ] x , CloudException t ) throws CloudException { if ( x != null ) { resultGood = true ; Log . i ( "Amount" , String . valueOf ( x . length ) ) ; usersNames . clear ( ) ; usersLocations . clear ( ) ; distances . clear ( ) ; for ( CloudObject object : x ) { try { JSONObject geopoint = new JSONObject ( object . get ( "reqLocation" ) . toString ( ) ) ; String coordinates = geopoint . getString ( "coordinates" ) . replace ( "[" , "" ) . replace ( "]" , "" ) ; String [ ] latLng = coordinates . split ( "," ) ; String stringLat = latLng [ 1 ] . replace ( "," , "" ) ; String stringLng = latLng [ 0 ] . replace ( "," , "" ) ; Double latitude = Double . parseDouble ( stringLat ) ; Double longitude = Double . parseDouble ( stringLng ) ; Location aUserLocation = new Location ( provider ) ; aUserLocation . setLatitude ( latitude ) ; aUserLocation . setLongitude ( longitude ) ; Log . i ( "User<seq2seq4repair_space>Lat//Lng" , ( ( ( String . valueOf ( aUserLocation . getLatitude ( ) ) ) + "//" ) + ( String . valueOf ( aUserLocation . getLongitude ( ) ) ) ) ) ; double distance = driverLocation . distanceTo ( aUserLocation ) ; double distanceMiles = ( Math . round ( ( ( distance * 6.21371E-4 ) * 100 ) ) ) // 100 ; usersNames . add ( object . get ( "reqUsername" ) . toString ( ) ) ; actualNames . add ( object . get ( "reqActualName" ) . toString ( ) ) ; usersLocations . add ( aUserLocation ) ; distances . add ( String . valueOf ( distanceMiles ) ) ; Log . i ( "Distance" , String . valueOf ( distanceMiles ) ) ; } catch ( JSONException e ) { e . printStackTrace ( ) ; } } } else if ( t != null ) { t . printStackTrace ( ) ; } } } ) ; } catch ( CloudException c ) { c . printStackTrace ( ) ; } } return null ; } @ Override protected void onPostExecute ( Void aVoid ) { } } @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onResume ( ) { } @ Override protected void onPause ( ) { } @ Override public void onLocationChanged ( Location location ) { } @ Override public void onStatusChanged ( String provider , int status , Bundle extras ) { } @ Override public void onProviderEnabled ( String provider ) { } @ Override public void onProviderDisabled ( String provider ) { } @ Override public void onBackPressed ( ) { } }

Fix:
query . orderByDesc ( "reqLocation" ) ;