From 49614a9051d6886ce345423717443b191a458c65 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 28 Jun 2013 09:11:43 +0200 Subject: [PATCH] Fixed device update constantly adding and removing devices. --- .../nutomic/controldlna/DeviceArrayAdapter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/github/nutomic/controldlna/DeviceArrayAdapter.java b/src/com/github/nutomic/controldlna/DeviceArrayAdapter.java index 099eb24..f281914 100644 --- a/src/com/github/nutomic/controldlna/DeviceArrayAdapter.java +++ b/src/com/github/nutomic/controldlna/DeviceArrayAdapter.java @@ -127,8 +127,15 @@ public class DeviceArrayAdapter extends ArrayAdapter> @Override public void remoteDeviceUpdated(Registry registry, RemoteDevice device) { - deviceRemoved(device); - deviceAdded(device); + if (!device.getType().getType().equals(mDeviceType)) + deviceRemoved(device); + mActivity.runOnUiThread(new Runnable() { + + @Override + public void run() { + notifyDataSetChanged(); + } + }); } private void deviceAdded(final Device device) {