Using java Syntax Highlighting
- private void addOverlaysToMap() {
- final List<Overlay> overlays = mapView.getOverlays();
- overlays.clear();
- normalItems.clear();
- warningItems.clear();
- overlays.add(myLocationOverlay);
- Cursor cursor = getContentResolver().query(Tracker.Locations.CONTENT_URI,
- new String[]{Tracker.Locations._FID, Tracker.Locations.LOCATION, Tracker.Locations.UPDATE_TIME},
- null, null, null);
- if (cursor.getCount() > 0) {
- // builds all the overlay items
- // convert to overlays
- convertGPRMCToOverlayItems(cursor);
- }
- cursor.close();
- if (warningItems.size() > 0) {
- overlays.add(warningItems);
- }
- if (normalItems.size() > 0) {
- overlays.add(normalItems);
- }
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
Because I am receiving coordinates it is essential to refresh every x amount of seconds. When I create a separate class for the refresh thread everything works fine but it randomly crashes with an uncaught exception.
Using java Syntax Highlighting
- class refreshTicker implements Runnable{
- public void run() {
- while(!Thread.currentThread().isInterrupted()){
- DisplayLoc.this.addOverlaysToMap();
- try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
- }
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Any suggestions?


