Re: [android-developers] show toast message while waiting for location
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 geoan...@gmail.com 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 android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] show toast message while waiting for location
Toasts automatically disappear after a short period of time. Thanks. On Thursday, May 16, 2013 2:10:38 AM UTC-5, geo wrote: 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 geoan...@gmail.com 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 android-d...@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] show toast message while waiting for location
Have you looked at LogCat output? Also, as Bob said, toast messages will display and then disappear. It sounds like you want to be displaying a progress dialog instead of a toast. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, May 16, 2013 at 8:56 AM, bob b...@coolfone.comze.com wrote: Toasts automatically disappear after a short period of time. Thanks. On Thursday, May 16, 2013 2:10:38 AM UTC-5, geo wrote: 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/**magouyawarehttp://sites.google.com/site/magouyaware On Wed, May 15, 2013 at 2:25 AM, geo geoan...@gmail.com 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 android-d...@googlegroups.com To unsubscribe from this group, send email to android-developers+**unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/**group/android-developers?hl=enhttp://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 android-developers+**unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] show toast message while waiting for location
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 geoandr...@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.