How to develope android application? Plz give the answer....with coding. On 15 May 2012 17:33, "Perry168" <perry...@gmail.com> wrote:
> Hi all, > ****** > > I hope to get user's country and city without using GPS. Basically, I know > how to get user's country. I searched some post from the web. It can use > LocationManager through NETWORK_PROVIDER to have the Latitude & Longitude. > From Latitude & Longitude, use GeoEncoder to find the city. **** > > The follow is my LocationManager part:**** > > ** ** > 1. public void onCreate(Bundle savedInstanceState) {**** > 2. ** ** > 3. super.onCreate(savedInstanceState);**** > 4. ** ** > 5. setContentView(R.layout.main);**** > 6. ** ** > 7. loMgr = (LocationManager) getSystemService(LOCATION_SERVICE);**** > 8. ** ** > 9. loMgr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, > 0, this);**** > 10. ** ** > 11. }**** > 12. ** ** > 13. ** ** > 14. ** ** > 15. public void onLocationChanged(Location location) { > 16. ** ** > 17. TextView tv01 = (TextView)findViewById(R.id.TextView01);**** > 18. ** ** > 19. TextView tv02 = (TextView)findViewById(R.id.TextView02);**** > 20. ** ** > 21. tv01.setText("Latitudeļ¼ " + > String.valueOf(location.getLatitude()));**** > 22. ** ** > 23. tv02.setText("Longitudeļ¼" + > String.valueOf(location.getLongitude()));**** > 24. ** ** > 25. } > > **** > > Also I added the "android.permission.ACCESS_FINE_LOCATION" in > AndroidManifest.**** > > After testing, it is no result. **** > > Can anyone tell me how to fix it?**** > > Thanks a lot!**** > > ** ** > > ** ** > > -- > 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 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