Sign in - Google Accounts. Dec 27, 2013 Map Maker for Google Maps can prove useful for situations when you need to place a map on a website in order for the visitors to quickly find the location of your headquarters. This is a common.
Android allows us to integrate google maps in our application. You can show any location on the map , or can show different routes on the map e.t.c. You can also customize the map according to your choices.
Google Map - Layout file
Now you have to add the map fragment into xml layout file. Its syntax is given below −
Google Map - AndroidManifest file
The next thing you need to do is to add some permissions along with the Google Map API key in the AndroidManifest.XML file. Its syntax is given below −
Customizing Google Map
You can easily customize google map from its default view , and change it according to your demand.
Adding Marker
You can place a maker with some text over it displaying your location on the map. It can be done by via addMarker() method. Its syntax is given below −
Changing Map Type
You can also change the type of the MAP. There are four different types of map and each give a different view of the map. These types are Normal,Hybrid,Satellite and terrain. You can use them as below
Enable/Disable zoom
You can also enable or disable the zoom gestures in the map by calling the setZoomControlsEnabled(boolean) method. Its syntax is given below −
![]() Using Google Maps On Android
Apart from these customization, there are other methods available in the GoogleMap class , that helps you more customize the map. They are listed below −
Example
Here is an example demonstrating the use of GoogleMap class. It creates a basic M application that allows you to navigate through the map.
To experiment with this example , you can run this on an actual device or in an emulator.
![]()
Create a project with google maps activity as shown below −
It will open the following screen and copy the console url for API Key as shown below −
Copy this and paste it to your browser. It will give the following screen −
Click on continue and click on Create API Key then it will show the following screen
Here is the content of activity_main.xml.
Google Maps Download Free Android
Here is the content of MapActivity.java.
In the below code we have given sample latitude and longitude details
Following is the content of AndroidManifest.xml file.
Google Maps For Android
Output should be like this −
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |