关于Intent.ACTION_DIAL无法启动的问题!求大神指教。

afairycell 2013-12-12 05:30:13
java文档如下:
@Override
public void onClick(View v) {//重写onClick方法
Intent myIntent = new Intent(Intent.ACTION_DIAL);//创建Intent对象
Sample_3_5.this.startActivity(myIntent);//启动Android内置的拨号程序
}

XML如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="wyf.wpf"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Sample_3_5"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="7" />

</manifest>

出现的错误是android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.DIAL }

看的是ANDROID 2.0游戏开发实战宝典,网上查了很多方法代码应该没错,为什么一直有这个错误?是AVM没有拔号这个功能么?

我的虚拟机是这样的,求大神指教!

...全文
809 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
smilestone322 2015-12-05
  • 打赏
  • 举报
回复
我也碰到了这个问题,难道是模拟器的问题?
medallions 2015-11-21
  • 打赏
  • 举报
回复
button1.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ Intent intent=new Intent("Intent.ACTION_DIAL"); intent.setAction(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:10086")); startActivity(intent); } });
bajab 2014-04-13
  • 打赏
  • 举报
回复
xml文件中需要加入权限。 <manifest> ... <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission> ... </manifest>
goshiter 2013-12-13
  • 打赏
  • 举报
回复
force close 看看log , 试试楼上的这个,应该可以的,我当时就是这个搞得,本来是在布局中有个属性,但是那个属性有时候有问题,最后修改为这个样子 Intent myIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:123"));
afairycell 2013-12-13
  • 打赏
  • 举报
回复
真机上没问题,虚拟机出了这个错误,估计是API没有打电话功能吧。。
依然绿茶 2013-12-12
  • 打赏
  • 举报
回复
理论上没问题的,你要不用这个试试: Intent myIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:123")); 再不行,你用真机测试测试,看手机上行不行。
ARy 2013-12-12
  • 打赏
  • 举报
回复
需要权限,加入对应的权限
金黄金黄即可 2013-12-12
  • 打赏
  • 举报
回复
换个版本的虚拟机
afairycell 2013-12-12
  • 打赏
  • 举报
回复
在手机上运行通过,AVM要怎么添加拔号功能的?为什么没有了?

80,362

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧