Add a toast warning message when not able to install Google

Earth from the Play store.
This commit is contained in:
Jimmy Shih
2012-06-22 12:41:15 -07:00
parent ec8e8acb27
commit c885e9d0dd
2 changed files with 14 additions and 1 deletions
+5
View File
@@ -2200,6 +2200,11 @@ limitations under the License.
Play Store.">
You need Google Earth to play the track. Do you want to install from the Play Store?
</string>
<string name="track_detail_install_earth_error"
translation_description="Message informing the user not able to install Google Earth from the
Play Store.">
Unalbe to install Google Earth from the Play Store.
</string>
<string name="track_detail_map_tab"
translation_description="In the track detail page, the title of the tab showing the map.">
Map
@@ -21,11 +21,13 @@ import com.google.android.maps.mytracks.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;
/**
* A DialogFragment to install Google Earth.
@@ -45,7 +47,13 @@ public class InstallEarthDialogFragment extends DialogFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent().setData(Uri.parse(SaveActivity.GOOGLE_EARTH_MARKET_URL));
startActivity(intent);
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(
getActivity(), R.string.track_detail_install_earth_error, Toast.LENGTH_LONG)
.show();
}
}
})
.create();