diff --git a/MyTracks/AndroidManifest.xml b/MyTracks/AndroidManifest.xml index 184ec39d8..084ae26f1 100755 --- a/MyTracks/AndroidManifest.xml +++ b/MyTracks/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="17" + android:versionName="1.0.16"> diff --git a/MyTracks/src/com/google/android/apps/mymaps/MyMapsGDataWrapper.java b/MyTracks/src/com/google/android/apps/mymaps/MyMapsGDataWrapper.java index de4e0f069..365edb94f 100644 --- a/MyTracks/src/com/google/android/apps/mymaps/MyMapsGDataWrapper.java +++ b/MyTracks/src/com/google/android/apps/mymaps/MyMapsGDataWrapper.java @@ -114,7 +114,7 @@ public class MyMapsGDataWrapper { } catch (HttpException e) { Log.e(MyTracksConstants.TAG, "HttpException", e); errorMessage = e.getMessage(); - if (errorMessage.contains("401")) { + if (errorMessage != null && errorMessage.contains("401")) { errorType = ERROR_AUTH; } else { errorType = ERROR_CONNECTION; @@ -122,7 +122,7 @@ public class MyMapsGDataWrapper { } catch (IOException e) { Log.e(MyTracksConstants.TAG, "Exception", e); errorMessage = e.getMessage(); - if (errorMessage.contains("503")) { + if (errorMessage != null && errorMessage.contains("503")) { errorType = ERROR_INTERNAL; } else { errorType = ERROR_CONNECTION; diff --git a/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java b/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java index 84e1546bf..8441dabc7 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java +++ b/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java @@ -1,12 +1,12 @@ /* * Copyright 2008 Google Inc. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -131,15 +131,15 @@ public class MyTracksOverlay extends Overlay { /** * Add a location to the map overlay. - * + * * NOTE: this method takes ownership of this location and may change it. - * + * * @param l the location to add */ public void addLocation(Location l) { points.add(l); } - + public void addWaypoint(Waypoint wpt) { waypoints.add(wpt); } @@ -170,6 +170,9 @@ public class MyTracksOverlay extends Overlay { ArrayList currentWaypoints = waypoints; for (int i = 1; i < currentWaypoints.size(); i++) { Waypoint wpt = currentWaypoints.get(i); + if (wpt == null) { + continue; + } Location loc = wpt.getLocation(); if (loc == null) { continue; diff --git a/MyTracks/src/com/google/android/apps/mytracks/WelcomeActivity.java b/MyTracks/src/com/google/android/apps/mytracks/WelcomeActivity.java index 4b717cc9a..42edd66f6 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/WelcomeActivity.java +++ b/MyTracks/src/com/google/android/apps/mytracks/WelcomeActivity.java @@ -19,12 +19,17 @@ import com.google.android.maps.mytracks.R; import android.app.Activity; import android.app.AlertDialog; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.webkit.WebView; +import android.widget.TextView; /** * An activity that displays a welcome screen. @@ -72,5 +77,16 @@ public class WelcomeActivity extends Activity { builder.setIcon(R.drawable.arrow_icon); AlertDialog dialog = builder.create(); dialog.show(); + + // Get the version from the manifest. + try { + PackageInfo pi = + getPackageManager().getPackageInfo("com.google.android.maps.mytracks", + PackageManager.GET_META_DATA); + ((TextView) dialog.findViewById(R.id.about_version_register)). + setText(pi.versionName); + } catch (NameNotFoundException e) { + Log.w(MyTracksConstants.TAG, "Failed to get version info.", e); + } } }