diff --git a/android-uribeacon/uribeacon-library/src/main/java/org/uribeacon/widget/ScanResultAdapter.java b/android-uribeacon/uribeacon-library/src/main/java/org/uribeacon/widget/ScanResultAdapter.java index fe25087..89e6cbe 100644 --- a/android-uribeacon/uribeacon-library/src/main/java/org/uribeacon/widget/ScanResultAdapter.java +++ b/android-uribeacon/uribeacon-library/src/main/java/org/uribeacon/widget/ScanResultAdapter.java @@ -190,6 +190,13 @@ public int compareTo(@NonNull DeviceSighting other) { final String otherAddress = other.scanResult.getDevice().getAddress(); // Sort by the stabilized region of the device, unless // they are the same, in which case sort by distance. + final String nearest = mRegionResolver.getNearestAddress(); + if (address.equals(nearest)) { + return -1; + } + if (otherAddress.equals(nearest)) { + return 1; + } int r1 = mRegionResolver.getRegion(address); int r2 = mRegionResolver.getRegion(otherAddress); if (r1 != r2) {