Hello,
Please help find my mistake - I have one thread, that starts location listener and other thread runTh(), which starts and waiting coordinates. My thread runTh() does not continue working, when locationUpdated() gets coordinates:
Code:.. // Start querying GPS data : new Thread() { public void run() { locationProvider.setLocationListener(TrackMe.this, sec, -1, -1); busy = true; } }.start(); runTh(); .... .... public void runTh(){ new Thread() { public void run() { synchronized (this) { if(busy) { try { gps2.setText("Thread waiting"); wait(); //do something } catch (InterruptedException ex) { ex.printStackTrace(); } } } } }.start(); } ... ... public synchronized void locationUpdated(LocationProvider provider, Location location) { if (location != null && location.isValid()) { statusDisplay.setText("Available\n"); QualifiedCoordinates qc = location.getQualifiedCoordinates(); gps = gps + "Lat: " + qc.getLatitude() + "\n" + "Lon: " + qc.getLongitude() + "\n"; busy = false; notify(); } } ...

Reply With Quote

