英文:
How to fix Ambiguous constructor error in Netbeans?
问题
我遇到了以下编译时错误:
对 BiometricPrompt 的引用不明确,因为构造函数
BiometricPrompt(FragmentActivity,Executor,AuthenticationCallback) 在 BiometricPrompt 中与构造函数 BiometricPrompt(Fragment,Executor,AuthenticationCallback) 匹配
而且 BiometricPrompt 是一个由 Android 系统生成的类
我正在按照以下方式创建 BiometricPrompt
的对象,你可以看到我将 mActivity
强制转换为 (FragmentActivity)
。
new BiomtericPrompt((FragmentActivity) mActivity, mExecutor, new BiometricPrompt.AuthenticationCallcack(){
....
})
上述代码在 AndroidStudio 中运行良好,但在 NetBeans IDE 8.2 中出现错误。
英文:
I am seeing a compile time error as follow
reference to BiometrucPrompt is ambiguous both constructor
BiometricPrompt(FragmentActivity,Executor,AuthenticationCallback) in BiometricPrompt and constructor BiometricPrompt(Fragment,Executor,AuthenticationCallback) in BiometricPrompt match
and BiometricPrompt is a Android/system generated class
I am creating the object of BiometricPrompt
as follow, you can see I am type casting the mActivity
to (FragmentActivity)
.
new BiomtericPrompt((FragmentActivity) mActivity, mExecutor, new BiometricPrompt.AuthenticationCallcack(){
....
})
The above code works fine in AndroidStudio but is giving error in NetBeans IDE 8.2.
答案1
得分: 0
你将属性"mActivity" 强制转换为 "FragmentAiviy",而不是 "FragmentActivity"。或者那只是拼写错误吗?
编辑:是的,是拼写错误。
英文:
You cast the attribute "mActivity" to "FragmentAiviy", not "FragmentActivity". Or was that just a spelling mistake?
EDIT: Yes it was
专注分享java语言的经验与见解,让所有开发者获益!
评论