小编Mar*_*arv的帖子

toast无法解析,并且activitynotfoundexception无法解析为某个类型

我想在我的应用中导入谷歌地图.

这是代码: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无法解析.

这怎么可能?

感谢名单.

android google-maps exception toast

0
推荐指数
1
解决办法
2229
查看次数

标签 统计

android ×1

exception ×1

google-maps ×1

toast ×1