如何在Netbeans中解决模糊构造函数错误?

huangapple 未分类评论53阅读模式
英文:

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

huangapple
  • 本文由 发表于 2020年4月7日 02:39:21
  • 转载请务必保留本文链接:https://java.coder-hub.com/61066702.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定