The problem is that it doesn't work. When I press now the button to start searching for signal it doesn't start at all. Also, I am not sure if it will work like the way I want. Show "Waiting" while searching for signal and then show the coordinates when it will find them.
Τη Πέμπτη, 16 Μαΐου 2013 12:01:24 π.μ. UTC+3, ο χρήστης MagouyaWare έγραψε: > > Ummm... what exactly is your question? > > Thanks, > Justin Anderson > MagouyaWare Developer > http://sites.google.com/site/magouyaware > > > On Wed, May 15, 2013 at 2:25 AM, geo <[email protected] <javascript:>>wrote: > >> Hello , >> >> I have an application where I use GPS and I want while GPS is looking for >> position to display a toast "Waiting for location" and when location is >> found show the location. >> >> To start GPS I press a button: >> >> case R.id.getlocation: >>> >> gps = new GPSTracker(ShowList.this); >>> >> >> // check if GPS enabled >> >> if(gps.canGetLocation()){ >> >> >> latitude = gps.getLatitude(); >> >> longitude = gps.getLongitude(); >> >> >> >> Toast.makeText(getApplicationContext(), "Your Location is \nLat: " + >> latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); >> >> >> >> }else{ >> >> //show dialog for enabling GPs >> >> gps.showSettingsAlert(); >> >> } >> >> >> Now, with the above it shows "latitude and latitude :0 " because I >> initialize them to 0. >> >> case R.id.getlocation: >>> >> gps = new GPSTracker(ShowList.this); >>> >> // check if GPS enabled >>> >> if(gps.canGetLocation()){ >>> >> showToast(); >>> >> }else{ >>> >> >> >> gps.showSettingsAlert(); >>> >> } >>> >> >>> private void showToast() { >>> >> new Thread() { >>> >> public void run() { >>> >> try { >>> >> while (message) { >>> >> runOnUiThread(new Runnable() { >>> >> @Override >>> >> public void run() { >>> >> >> latitude = gps.getLatitude(); >> >> longitude = gps.getLongitude(); >> >> >> Toast.makeText(getApplicationContext(), "Waiting for location", >> Toast.LENGTH_LONG).show(); >> >> >> //}else{ >> >> // gps.showSettingsAlert(); >> >> // } >> >> >> } >> >> }); >> >> Thread.sleep(1000); >> >> message=false; >> >> >> } >> >> } catch (InterruptedException e) { >> >> e.printStackTrace(); >> >> } >> >> } >> >> }.start(); >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to >> [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Android Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

