1

I am working with google map and I want to show an address in map by its longitude and latitude value.My code is like this :

   String coordinates[] = { getString(R.string.lat), getString(R.string.lon) };
    String url = "geo:" + coordinates[0] + "," + coordinates[1] + "?q=" + coordinates[0] + "," + coordinates[1];
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    startActivity(i);

String values are :

<string name="lat">39.4457295</string>
<string name="lon">-76.81679639999999</string>

But instead of map, it is showing in my emulator:

Map not showing

I am new in map API. And I don't know why this is happening.

Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99

3 Answers3

0

Ok first of all if you are getting that in your emulator then you are probably using the wrong google maps API. Google just recently released a new maps api for android. New Google Maps API

The new google maps api does not run in an emulator as of right now. This is according to the api resources and also it can be found in this link Apparently there are a few people who have made the maps api work in the emulator but personally i just test on a real device.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
doubleA
  • 2,446
  • 22
  • 45
  • Thanks for your response. If I use the old google API, what will be the problem ? Many apps right now are using old API and they are working well. – user1988448 Jan 18 '13 at 11:38
  • Sure you can use the old api. But i will tell you that the new one has some nice features in it that make maps really easy. Still some new drawbacks but a big improvement. Like support for multiple map views and map fragments. But if you are not using the new api then your problem looks like an issue with your api key. Maybe you entered in the wrong hash key. – doubleA Jan 19 '13 at 00:39
0

Make sure your map key is set correctly, and you are launching in debug mode.

Derek
  • 1
0

Your code is so complicated to me. Your Geocode is right and I can see your location very well on my phone from Seoul,Korea. When using intent to display Google map, NOT any permission is required except setting WiFi or 3G in your phone. In using Intent method to display Google map on your phone or the emulator, I recommend you as follows;

Note that you MUST set the Build Target to the "Google APIs", Not to "Android x.x. version", specially on the AVD of the emulator.

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:"+39.4457295+","+-76.81679639999999));
startActivity(intent);

I added your Geocode to the above. With the code above, I saw your location on my phone where I live in Seoul,Korea. Your geo is Owings Ct near Reisterstown?...right?

BBonDoo
  • 766
  • 5
  • 14