SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
MAPS IN ANDROID
By-
Sumita Das
 Android allows us to integrate Google maps in our application.
 Customize the map according to your choices.
Created by Sumita Das
Several classes that are used to support Android maps:
 MapView: User interface element that displays the map.
 MapActivity: Base class used to create an Activity that can include
a Map View.
 Overlay: Class used to annotate your maps
 MapController: Used to control the map, and enables the user to set
the center location and zoom levels.
 MyLocationOverlay: Can be used to display the current position
and orientation of the device.
Created by Sumita Das
 Obtain an API key from the Android developer website at
http://code.google.com/android/maps-api-signup.html.
 To obtain a key, you need to specify the MD5 fingerprint of
the certificate used to sign your application. .
Created by Sumita Das
 To use maps- extend MapActivity.
 The layout for the new class must then include a MapView to
display a Google Maps interface element.
 Android maps library - optional API.
 So it must be explicitly included in the application manifest
before it can be used.
<uses-library
android:name=”com.google.android.maps”/>
Created by Sumita Das
 Map View :
-Downloads its map tiles on demand
- Any application that features a Map View needs to include a
uses-permission for Internet access.
 Add a uses-permission tag to your application manifest for
INTERNET, as shown here:
 After adding the library and configuring your permission,
you’re ready to create your new map-based Activity.
<uses-permission
android:name=”android.permission.INTERNET”/>
Created by Sumita Das
<?xml version=”1.0” encoding=”utf-8”?>
<LinearLayout
xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
<com.google.android.maps.MapView
android:id=”@+id/map_view”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:enabled=”true”
android:clickable=”true”
android:apiKey=”mymapapikey”/>
</LinearLayout>
Created by Sumita Das
import com.google.android.maps.MapActivity; // import classes
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class MyMapActivity extends MapActivity
{
private MapView mapView;
private MapController mapController;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_layout);
mapView = (MapView)findViewById(R.id.map_view);
}
@Override
protected boolean isRouteDisplayed() {
// IMPORTANT: This method must return true if your Activity is displaying
driving directions. Otherwise return false.
return false;
}} Created by Sumita Das
Created by Sumita Das
1. To display a satellite view and the expected traffic overlay:
mapView.setSatellite(true);
mapView.setTraffic(true);
2. To find the current and maximum available zoom levels:
int maxZoom = mapView.getMaxZoomLevel();
int currentZoom = mapView.getZoomLevel();
Created by Sumita Das
3. To obtain center point and currently visible longitude and
latitude span (in decimal degrees).
GeoPoint center = mapView.getMapCenter();
int latSpan = mapView.getLatitudeSpan();
int longSpan = mapView.getLongitudeSpan();
Created by Sumita Das
[1]Wei-Meng Lee, “Beginning Android
Application Development”, Wiley Publishing
Inc.
Created by Sumita Das

More Related Content

PDF
Android Location and Maps
PPT
Android - Android Geocoding and Location based Services
PPT
android activity
PDF
Layouts in android
PPTX
Mobile application development ppt
PDF
Introduction to fragments in android
PPTX
PDF
Android: Intent, Intent Filter, Broadcast Receivers
Android Location and Maps
Android - Android Geocoding and Location based Services
android activity
Layouts in android
Mobile application development ppt
Introduction to fragments in android
Android: Intent, Intent Filter, Broadcast Receivers

What's hot (20)

PPTX
SQLite database in android
PPTX
Advance Java Topics (J2EE)
PPT
SQLITE Android
PPTX
Android User Interface
PDF
Android activities & views
PPT
Android - Android Intent Types
PPTX
Activity lifecycle
PPTX
Introduction to Android and Android Studio
PPTX
Android studio ppt
PPTX
05 intent
PPT
Asp.net control
PPTX
Java Server Pages(jsp)
PPTX
Presentation on Android application life cycle and saved instancestate
PPTX
Presentation on Android application
PPTX
Android UI
PPTX
Android Services
PPTX
OOP Introduction with java programming language
PDF
Android intents
PPTX
Notification android
PDF
Action Bar in Android
SQLite database in android
Advance Java Topics (J2EE)
SQLITE Android
Android User Interface
Android activities & views
Android - Android Intent Types
Activity lifecycle
Introduction to Android and Android Studio
Android studio ppt
05 intent
Asp.net control
Java Server Pages(jsp)
Presentation on Android application life cycle and saved instancestate
Presentation on Android application
Android UI
Android Services
OOP Introduction with java programming language
Android intents
Notification android
Action Bar in Android
Ad

Viewers also liked (14)

PDF
So, You Wannna Be a CTO - Romain Cochet
PPTX
Sarine's Big Data Journey by Rostislav Aaronov
PDF
Oświadczenie DRMG
DOC
ResumeDilipKumarPanchali (1)
DOC
David Walker Resume 2015 (nov nor)
PDF
Głos marszałka województwa pomorskiego ws. przekopu
PDF
Ruby Gems and Native Extensions - Stas Volovyk
PPTX
Starting out with Scrum
PPTX
Jane ramsay
PDF
"How we make Agile and CI/CD works" by Rendra Toro (OLX Indonesia)
PPTX
21 11-16 dd3 growth mindset powerpoint
PDF
[244] 분산 환경에서 스트림과 배치 처리 통합 모델
PDF
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
PDF
Rethinking Streaming Analytics For Scale
So, You Wannna Be a CTO - Romain Cochet
Sarine's Big Data Journey by Rostislav Aaronov
Oświadczenie DRMG
ResumeDilipKumarPanchali (1)
David Walker Resume 2015 (nov nor)
Głos marszałka województwa pomorskiego ws. przekopu
Ruby Gems and Native Extensions - Stas Volovyk
Starting out with Scrum
Jane ramsay
"How we make Agile and CI/CD works" by Rendra Toro (OLX Indonesia)
21 11-16 dd3 growth mindset powerpoint
[244] 분산 환경에서 스트림과 배치 처리 통합 모델
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Rethinking Streaming Analytics For Scale
Ad

Similar to Maps in android (20)

DOCX
Location Based Services Android Google Maps API with Examples
PDF
Intro To Google Maps
PDF
Invading the home screen
PPTX
Android chapter25-map views
PPT
Beginning Native Android Apps
PDF
android level 3
PDF
Hierarchy viewer
PPTX
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
PPTX
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
PPTX
Android mobile application for gps
PDF
Maps API on_mobile_dev_festbangkok
PPTX
Lecture #1 Creating your first android project
PDF
Support Design Library
PPTX
Android application for gps
PDF
How to use data binding in android
DOC
Android LAb - Creating an android app with Radio button
PPTX
Introduction to Android Programming
PDF
Android App development and test environment, Understaing android app structure
PDF
Fragments: Why, How, What For?
PPTX
Android MapView and MapActivity
Location Based Services Android Google Maps API with Examples
Intro To Google Maps
Invading the home screen
Android chapter25-map views
Beginning Native Android Apps
android level 3
Hierarchy viewer
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
Life After Mobilegeddon: App Deep Linking Strategies - Pubcon October 2015
Android mobile application for gps
Maps API on_mobile_dev_festbangkok
Lecture #1 Creating your first android project
Support Design Library
Android application for gps
How to use data binding in android
Android LAb - Creating an android app with Radio button
Introduction to Android Programming
Android App development and test environment, Understaing android app structure
Fragments: Why, How, What For?
Android MapView and MapActivity

More from Sumita Das (10)

PPTX
Numerical on bisection method
PPTX
Numerical on dichotomous search
PPT
Presentation on binary search, quick sort, merge sort and problems
PPTX
Loop alignment
PPTX
Hardware and software parallelism
PPTX
Trusted systems1
PPTX
Activity selection problem
PPTX
Multiprotocol label switching
PPTX
Asymptotic analysis of parallel programs
PPTX
Distributed systems1
Numerical on bisection method
Numerical on dichotomous search
Presentation on binary search, quick sort, merge sort and problems
Loop alignment
Hardware and software parallelism
Trusted systems1
Activity selection problem
Multiprotocol label switching
Asymptotic analysis of parallel programs
Distributed systems1

Recently uploaded (20)

PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PDF
Abrasive, erosive and cavitation wear.pdf
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PPT
Occupational Health and Safety Management System
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PPTX
Artificial Intelligence
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Safety Seminar civil to be ensured for safe working.
86236642-Electric-Loco-Shed.pdf jfkduklg
Abrasive, erosive and cavitation wear.pdf
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
Occupational Health and Safety Management System
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Automation-in-Manufacturing-Chapter-Introduction.pdf
Information Storage and Retrieval Techniques Unit III
Exploratory_Data_Analysis_Fundamentals.pdf
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
Nature of X-rays, X- Ray Equipment, Fluoroscopy
Artificial Intelligence
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...

Maps in android

Editor's Notes

  • #3: Show any location on the map , or show different routes on the map. Map Views offer full programmatic control of the map display, letting you control the zoom, location, and display modes including the option to display a satellite view
  • #5: To use a Map View in your application, you must first Without an API key the Map View cannot download the tiles used to display the map.