Toast Doesn't Disappear From Screen
I have a problem with my simple android aplication that use GPS cords. My class MyLocationListener implements LocationListener, and there is a static method call: String strTex
Solution 1:
Please read the docs of the method LocationManager.requestLocationUpdates().
Especially the parameter:
minTime minimum timeintervalbetween location updates, in milliseconds.
Try value 10'000 for every 10 sec. In production you should consider value more than mins.
Solution 2:
I think, you add your code in your location detection function and LocationListener
is active. That means your Toast is called when GPS detect new location.
Solution 3:
Looks like your location listener is active and repeatedly gets called. are you moving your device? LocationListener is called when the location changes.
Solution 4:
Try this,
1 .
Toast.makeText(getBaseContext(), strText, Toast.LENGTH_SHORT).show();
2 .
@OverridepublicvoidonPause() {
super.onPause();
locationManager.removeUpdates(locationListener);
}
3 .
@OverridepublicvoidonResume() {
super.onResume();
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
Length, long, locationListener);
}
Length and long should be more than 0.
Post a Comment for "Toast Doesn't Disappear From Screen"