【发布时间】:2026-01-13 04:05:02
【问题描述】:
我正在尝试让我的应用从 EditText 调用一个号码,但我得到:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.DIAL dat=Ring Tel nr. 123456789 }
我已经搜索了一段时间以寻找答案,但大多数答案都是权限并将活动添加到清单。我都做过,如果我没有做错的话。我在手机上运行它,而不是模拟器。我已经尝试过使用和不使用意图过滤器。以下是代码:
清单:<uses-permission android:maxSdkVersion="19" android:name="android.permission.CALL_PHONE"/>
<activity
android:name="nu.sluggo.testapp.annons.Activity2">
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
拨打电话的按钮(从 SharedPrefs 获取电话号码到下面的 a1 :)
knapp_ring.setOnClickListener(new View.OnClickListener() {
Intent call = new Intent(Intent.ACTION_DIAL);
@Override
public void onClick(View v){
call.setData(Uri.parse("Telnr:" + a1));
startActivity(call);
}
});
【问题讨论】:
-
已解决:*.com/a/32264013/11211963 建议检查设备是否支持电话。
-
1.使用模拟器时会出现此错误
标签: android android-intent android-permissions phone-number phone-call