How to get current location(GPS) after click on radio button in my android app?

Use this code in radiobutton onclick event Location location; protected LocationManager locationManager; locationManager = (LocationManager) getSystemService(Context. LOCATION_SERVICE); location = locationManager. GetLastKnownLocation(LocationManager.

GPS_PROVIDER); if (location! = null) { String message = String. Format( "Current Location \n Longitude: %1$s \n Latitude: %2$s", location.getLongitude(), location.getLatitude()); Toast.

MakeText(LbsGeocodingActivity. This, message, Toast. LENGTH_LONG).show(); List mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().

GetDrawable( R.drawable. New3pin); ItemizedOverlay itemizedoverlay = new ItemizedOverlay( drawable, LbsGeocodingActivity. This); itemizedoverlay.

AddOverlay(overlayitem); mapOverlays. Add(itemizedoverlay); } else { Toast. MakeText(LbsGeocodingActivity.

This, "No Location Found", Toast. LENGTH_LONG).show(); } second Java class public class ItemizedOverlay extends ItemizedOverlay { private ArrayList mOverlays = new ArrayList(); Context mContext; @Override protected OverlayItem createItem(int i) { // TODO Auto-generated method stub return mOverlays. Get(i); } @Override public int size() { // TODO Auto-generated method stub return mOverlays.size(); } public void addOverlay(OverlayItem overlay) { mOverlays.

Add(overlay); populate(); } public ItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } }.

Use this code in radiobutton onclick event..... Location location; protected LocationManager locationManager; locationManager = (LocationManager) getSystemService(Context. LOCATION_SERVICE); location = locationManager. GetLastKnownLocation(LocationManager.

GPS_PROVIDER); if (location! = null) { String message = String. Format( "Current Location \n Longitude: %1$s \n Latitude: %2$s", location.getLongitude(), location.getLatitude()); Toast.

MakeText(LbsGeocodingActivity. This, message, Toast. LENGTH_LONG).show(); List mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().

GetDrawable( R.drawable. New3pin); ItemizedOverlay itemizedoverlay = new ItemizedOverlay( drawable, LbsGeocodingActivity. This); itemizedoverlay.

AddOverlay(overlayitem); mapOverlays. Add(itemizedoverlay); } else { Toast. MakeText(LbsGeocodingActivity.

This, "No Location Found", Toast. LENGTH_LONG).show(); } second Java class.. public class ItemizedOverlay extends ItemizedOverlay { private ArrayList mOverlays = new ArrayList(); Context mContext; @Override protected OverlayItem createItem(int i) { // TODO Auto-generated method stub return mOverlays. Get(i); } @Override public int size() { // TODO Auto-generated method stub return mOverlays.size(); } public void addOverlay(OverlayItem overlay) { mOverlays.

Add(overlay); populate(); } public ItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } }.

I have pasted the sample code Here Crete one interface to notify when location is obtained.. put code in OnClick event(or onSelected) of your Radio button LocProvider locProvider = LocProvider.getInstance(); locProvider. Init(this); locProvider. InitializeLocationSearch(); locProvider.

SetLocationCallbackListener().

Current location after click on radio button is gotten (without quotes):.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions