【发布时间】:2013-12-14 12:11:24
【问题描述】:
我想在我的应用中导入谷歌地图。
这是代码: public static void maps(Activity 活动,字符串地址) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?q=" + address));
activity.startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(activity, activity.getString(R.id.webView), Toast.LENGTH_SHORT).show();
}
}
public static void navigation(Activity activity, String address) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + address));
activity.startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(activity, activity.getString(R.id.webView), Toast.LENGTH_SHORT).show();
}
}
我得到 2 个错误。 ActivityNotFoundException 无法解析为类型,Toast 无法解析。
这怎么可能?
谢谢。
【问题讨论】:
标签: android google-maps exception toast