Mar*_*arv 0 android google-maps exception toast
我想在我的应用中导入谷歌地图.
这是代码:public static void maps(Activity activity,String address){
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();
}
}
Run Code Online (Sandbox Code Playgroud)
我得到2个错误.ActivityNotFoundException无法解析为类型而Toast无法解析.
这怎么可能?
感谢名单.