【问题标题】:android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=tel:xxxxx }android.content.ActivityNotFoundException:没有找到处理意图的活动 { act=android.intent.action.VIEW dat=tel:xxxxx }
【发布时间】:2016-12-16 03:12:15
【问题描述】:

我遇到了一个问题 但是不知道问题出在哪里 这是我的代码

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("tel:"+"phonenumber" ));
startActivity(intent);

【问题讨论】:

    标签: android exception


    【解决方案1】:

    试试这个:

    Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("tel:%s", phonenumber)));
    startActivity(in);
    

    【讨论】:

    • 感谢您的帮助。但我想知道为什么会这样。我认为我的代码没问题,但它确实发生了。
    • 您确定使用了电话号码变量或“电话号码”作为字符串值。这就是为什么我建议使用 String.format 而不是字符串连接。 ACTION_VIEW 应该没问题,所以唯一可能的故障点是 URI
    猜你喜欢
    • 1970-01-01
    • 2020-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-28
    • 2011-08-18
    相关资源
    最近更新 更多