From a20b2e4789fca22a8c2175adc6459d40eb1f4d9f Mon Sep 17 00:00:00 2001 From: bspeice Date: Mon, 28 Oct 2013 15:12:12 -0400 Subject: [PATCH] Add utility code to make navigation easy --- src/com/uncc/gameday/parking/ParkingCoordinate.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/com/uncc/gameday/parking/ParkingCoordinate.java b/src/com/uncc/gameday/parking/ParkingCoordinate.java index 3fe8587..be1a966 100644 --- a/src/com/uncc/gameday/parking/ParkingCoordinate.java +++ b/src/com/uncc/gameday/parking/ParkingCoordinate.java @@ -1,5 +1,8 @@ package com.uncc.gameday.parking; +import android.content.Intent; +import android.net.Uri; + public class ParkingCoordinate { private double latitude; private double longitude; @@ -24,6 +27,16 @@ public class ParkingCoordinate { this.label = label; } + public Uri getNavigationURI() { + // URI used to construct an intent for navigation + return Uri.parse("google.navigation:q=" + this.getLatitude() + "," + this.getLongitude()); + } + + public Intent getNavigationIntent() { + // Intent used to do navigation + return new Intent(Intent.ACTION_VIEW, this.getNavigationURI()); + } + public ParkingCoordinate(double latitude, double longitude, String label) { this.latitude = latitude; this.longitude = longitude;