草庐IT

delegating-constructor

全部标签

dart - 从路线导航回来时, flutter 搜索委托(delegate)不起作用

我在我的应用中使用FlutterSearchDelegate,代码如下:classNameSearchextendsSearchDelegate{@overrideListbuildActions(BuildContextcontext){return[IconButton(icon:Icon(Icons.clear),onPressed:(){query="";},)];}@overrideWidgetbuildLeading(BuildContextcontext){returnIconButton(icon:AnimatedIcon(icon:AnimatedIcons.menu

dart - 从路线导航回来时, flutter 搜索委托(delegate)不起作用

我在我的应用中使用FlutterSearchDelegate,代码如下:classNameSearchextendsSearchDelegate{@overrideListbuildActions(BuildContextcontext){return[IconButton(icon:Icon(Icons.clear),onPressed:(){query="";},)];}@overrideWidgetbuildLeading(BuildContextcontext){returnIconButton(icon:AnimatedIcon(icon:AnimatedIcons.menu

java - 尝试将 AndroidJUnit4 与标准 JUnit 运行器和委托(delegate)运行器一起使用 'org.robolectric.RobolectricTestRunner' 无法加载

我正在使用espresso运行一些测试,但我不知道为什么roboelectric包含在这个错误中,因为测试仅针对espresso,下面是错误:java.lang.Exception:AttemptedtouseAndroidJUnit4withstandardJUnitrunneranddelegaterunner'org.robolectric.RobolectricTestRunner'couldnotbeloaded.Checkyourbuildconfiguration.atandroid.support.test.runner.AndroidJUnit4.loadRunner

c# - Xamarin.Android 上的 JsonSerializationException 'Unable to find a constructor'

我的代码有这个非常奇怪的问题,这是一个相当新的问题,考虑到半年前我还没有遇到过它。长话短说,我在Xamarin中制作了一个应用程序,并于大约半年前在所有3家商店(AppStore、GooglePlay和MicrosoftStore)上发布了它。昨天一位用户报告了Android应用程序的问题,在我修复并重新编译之后,我现在遇到了Json.NET的新错误异常(exception)情况是Newtonsoft.Json.JsonSerializationException:UnabletofindaconstructortousefortypeRowlog.Common.Dtos.Compre

java - 火力地堡 "User is missing a constructor with no arguments"

我正在尝试从Firebase中的/User/树中检索我的用户详细信息。我有以下用户对象:publicclassUser{privateStringname;privateStringemail;privateFirebaseUserfirebaseUser;privateStringlastOnline;privateLatLnglatLng;privateArrayListlocations;publicUser(){}publicStringgetName(){if(firebaseUser.getDisplayName()!=null&&!firebaseUser.getDisp

android - junit.framework.AssertionFailedError : Exception in constructor: (java. lang.NoClassDefFoundError)

我正在尝试将espresso2实现到我的项目中,但我无法在测试中找出appcompat库依赖性的问题。当我使用Activity时,它起作用了。当我使用ActionBarActivity或FragmentActivity时,我得到了这个错误:junit.framework.AssertionFailedError:Exceptioninconstructor:testCheckText(java.lang.NoClassDefFoundError:ait.common.testunittest.app.MainActivity2atait.common.testunittest.app.

java - Kotlin 委托(delegate)给 future

我正在努力学习Kotlin,而代表既有趣又令人困惑。我有一种情况,在java类中,我将采用构造函数arg,创建Future(ID表示另一个系统中的资源)并将Future作为实例变量存储。然后“getXXX”会调用Future.get()这是一个示例java类publicclassExample{privateFuturefoo;publicExample(StringfooId){this.foo=supplyAsync(()->httpClient.get(fooId));}publicFoogetFoo(){returnfoo.get();}}我没有提供Kotlin示例,因为我根本

java - Kotlin 委托(delegate)给 future

我正在努力学习Kotlin,而代表既有趣又令人困惑。我有一种情况,在java类中,我将采用构造函数arg,创建Future(ID表示另一个系统中的资源)并将Future作为实例变量存储。然后“getXXX”会调用Future.get()这是一个示例java类publicclassExample{privateFuturefoo;publicExample(StringfooId){this.foo=supplyAsync(()->httpClient.get(fooId));}publicFoogetFoo(){returnfoo.get();}}我没有提供Kotlin示例,因为我根本

constructor - 为什么 Kotlin 有两种类型的构造函数?

Kotlin有两种类型的构造函数,主要的和次要的。有两种类型的目的是什么?在我看来,它使代码更加复杂和不一致。如果这两种类型的构造函数都创建了一个类的对象,那么它们对一个类同样重要。同时,多个初始化器也会引入困惑并降低可读性。 最佳答案 当您需要将作为构造函数参数传递的值保存到实例的属性时,主构造函数涵盖了流行的用例。基本上,主构造函数为声明属性和从构造函数参数初始化属性提供了简写。请注意,您完全可以在没有主构造函数的情况下执行相同操作:classFoo{valbar:Barconstructor(barValue:Bar){bar

constructor - 为什么 Kotlin 有两种类型的构造函数?

Kotlin有两种类型的构造函数,主要的和次要的。有两种类型的目的是什么?在我看来,它使代码更加复杂和不一致。如果这两种类型的构造函数都创建了一个类的对象,那么它们对一个类同样重要。同时,多个初始化器也会引入困惑并降低可读性。 最佳答案 当您需要将作为构造函数参数传递的值保存到实例的属性时,主构造函数涵盖了流行的用例。基本上,主构造函数为声明属性和从构造函数参数初始化属性提供了简写。请注意,您完全可以在没有主构造函数的情况下执行相同操作:classFoo{valbar:Barconstructor(barValue:Bar){bar