{"id":1158,"date":"2022-08-30T15:13:21","date_gmt":"2022-08-30T15:13:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/android-google-maps-issue-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:13:21","modified_gmt":"2022-08-30T15:13:21","slug":"android-google-maps-issue-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/android-google-maps-issue-collection-of-common-programming-errors\/","title":{"rendered":"android google maps issue-Collection of common programming errors"},"content":{"rendered":"<p>In the program below i am trying to use google map from the following example http:\/\/www.vogella.de\/articles\/AndroidLocationAPI\/article.html , i have followed exactly all the steps in the example but some how i am not able t execute it the APP closes down .<\/p>\n<p>Below is my code.Let me know what am i doing wrong here<\/p>\n<pre><code>package ShowMap.com;\n\nimport android.app.Activity;\nimport android.os.Bundle;\nimport android.content.Context;\nimport android.location.Location;\nimport android.location.LocationListener;\nimport android.location.LocationManager;\nimport android.widget.RelativeLayout;\n\nimport com.google.android.maps.GeoPoint;\nimport com.google.android.maps.MapActivity;\nimport com.google.android.maps.MapController;\nimport com.google.android.maps.MapView;\n\npublic class ShowmapActivity extends MapActivity {\nprivate MapController mapController;\nprivate MapView mapView;\nprivate LocationManager locationManager;\n\n\/** Called when the activity is first created. *\/\n@Override\npublic void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.main);\n    RelativeLayout linearLayout = (RelativeLayout) findViewById(R.id.mainlayout);\n    mapView = (MapView) findViewById(R.id.mapview);\n    mapView.setBuiltInZoomControls(true);\n    mapView.setStreetView(true);\n    mapController = mapView.getController();\n    mapController.setZoom(14); \/\/ Zoon 1 is world view\n    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);\n    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,\n            0, new GeoUpdateHandler());\n\n}\nprotected boolean isRouteDisplayed() {\n    return false;\n}\n\npublic class GeoUpdateHandler implements LocationListener {\n\n    @Override\n    public void onLocationChanged(Location location) {\n        int lat = (int) (location.getLatitude() * 1E6);\n        int lng = (int) (location.getLongitude() * 1E6);\n        GeoPoint point = new GeoPoint(lat, lng);\n        mapController.animateTo(point); \/\/  mapController.setCenter(point);\n    }\n\n    @Override\n    public void onProviderDisabled(String provider) {\n    }\n\n    @Override\n    public void onProviderEnabled(String provider) {\n    }\n\n    @Override\n    public void onStatusChanged(String provider, int status, Bundle extras) {\n    }\n}\n\n   }\n<\/code><\/pre>\n<p>Main.xml<\/p>\n<pre><code>\n\n\n\n<\/code><\/pre>\n<p>Android manifest.xml<\/p>\n<pre><code> \n \n\n\n\n    \n        \n            \n            \n        \n    \n\n\n\n\n\n\n\n\n\n\n<\/code><\/pre>\n<p><code>EDIT:This is the logcat trace<\/code><\/p>\n<pre><code>     07-18 15:20:46.065: DEBUG\/AndroidRuntime(469): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &gt; AndroidRuntime START &gt;&gt; AndroidRuntime START<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:33:06. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>In the program below i am trying to use google map from the following example http:\/\/www.vogella.de\/articles\/AndroidLocationAPI\/article.html , i have followed exactly all the steps in the example but some how i am not able t execute it the APP closes down . Below is my code.Let me know what am i doing wrong here package [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1158","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1158"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1158\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}