android - Issue in finding the lat and long in samsung S3 -
i not getting lat , long in samsung s3.in other devices code working fine , getting proper lat , long.below code lat , long.
public class mainactivity extends activity { textview textview1; location currentlocation; double currentlatitude,currentlongitude; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview1 = (textview) findviewbyid(r.id.textview1); findlocation(); } public void findlocation() { locationmanager locationmanager = (locationmanager) .getsystemservice(context.location_service); locationlistener locationlistener = new locationlistener() { public void onlocationchanged(location location) { updatelocation(location,currentlatitude,currentlongitude); toast.maketext( mainactivity.this, string.valueof(currentlatitude) + "\n" + string.valueof(currentlongitude), 5000) .show(); } public void onstatuschanged(string provider, int status, bundle extras) { } public void onproviderenabled(string provider) { } public void onproviderdisabled(string provider) { } }; locationmanager.requestlocationupdates( locationmanager.network_provider, 0, 0, locationlistener); } void updatelocation(location location,double currentlatitude,double currentlongitude) { currentlocation = location; this.currentlatitude = currentlocation.getlatitude(); this.currentlongitude = currentlocation.getlongitude(); textview1.settext(string.valueof(this.currentlatitude) + "\n" + string.valueof(this.currentlongitude)); } } in above code onlocationchanged() method not executing in s3 , same code not working in samsung s3 device.in other devices working fine.i getting correct lat , long in other devices.please me sort out problem..
Comments
Post a Comment