I want to make network operation in every 1sec and depending on data, i want to update the ListView continuously.
Following is my approach:
Using thread and handler.postDelayed, it makes the network request every sec and update only those views of the row in ListView which needs to be updated. It does not update ListView using notifyDatasetChanged().
Though it updates the UI, but it takes time in updating the UI. Is it because, I am using emulator?
Is this the right approach for this scenario? Any other best approach for this?
The approach I would take is to have a dedicated service in my application; that service would start a thread to sit in a loop: sleep 1 second; perform the network request; post the results (if any).
The emulator can be very slow, depending on your system and the Android version you’re emulating. For me, with high end hardware, it seems emulating 2.2 is faster than 2.3, and that’s much faster than 3.0.