itnoles
03/01/2019, 4:11 PMmatt tighe
03/01/2019, 8:04 PMUnchecked cast: MyViewModel to T
, which leads me to believe there may be a better way
class MyViewModel(private val myDependency: MyDependency) : ViewModel() {}
class MyViewModelFactory(private val myDependency: MyDependency) : ViewModelProvider.NewInstanceFactory() {
override fun <T: ViewModel?> create(modelClass: Class<T>): T {
return MyViewModel(myDependency) as T
}
}
// In activity
private val myViewModel: MyViewModel by lazy {
val myDependency = MyDependency()
ViewModelproviders.of(this, MyViewmodelFactory(myDependency))
.get(MyViewModel::class.java)
}
jw
03/01/2019, 8:21 PMkd
03/01/2019, 9:42 PMscottiedog45
03/02/2019, 8:54 PMdangvh
03/03/2019, 4:18 AMno
03/03/2019, 10:39 PMjw
03/03/2019, 11:27 PMIve Vasiljevic
03/04/2019, 12:54 PMribesg
03/04/2019, 1:23 PMzachtib
03/04/2019, 1:50 PM{ "data": { ... } }
or { "error": { ... }}
for all of its calls. Are there any examples out there for modeling this using a sealed class w/ Retrofitzachtib
03/04/2019, 1:52 PMdvlwj
03/05/2019, 2:26 AMIve Vasiljevic
03/05/2019, 9:52 AMIve Vasiljevic
03/05/2019, 12:44 PMdave
03/05/2019, 3:34 PMBilagi
03/05/2019, 6:42 PMwork manager
released ? Earlier it was beta, are they released stable version ?Dave Leeds
03/05/2019, 8:04 PMRejecting re-init on previously-failed class java.lang.Class<kotlinx.coroutines.CoroutineExceptionHandlerImplKt>
The app doesn’t crash, but I’ve got a deferred.await()
that never seems to resume. There’s no other exception information following this message in the logs. Also, I’ve only seen this happen on Android 5.0 - even Android 5.1 seems to work fine.
Has anyone else run into this?dangvh
03/06/2019, 4:50 AMmaxmello
03/06/2019, 12:52 PM-assumenosideeffects class com.example.package.ExtensionsKt {
public static void myFunction(...);
}
The function is defined as follows:
fun Any.myFunction(param1: String, param2: Throwable? = null) {
...
}
But it does not work sadly, I also tried the following (method signature copied from mapping.txt) which also does not work:
-assumenosideeffects class com.example.package.ExtensionsKt {
public static void myFunction(java.lang.Object,java.lang.String,java.lang.Throwable);
public static void myFunction$default(java.lang.Object,java.lang.String,java.lang.Throwable,int,java.lang.Object);
}
ribesg
03/06/2019, 3:03 PMandroidx.core.view.doOnPreDraw
does not get called if the view is created while the device is locked, is it a known issue? Is there a workaround?Oleh Ponomarenko
03/06/2019, 4:46 PMamadeu01
03/06/2019, 6:18 PMmzgreen
03/07/2019, 7:07 AM@Parcelize
still being experimental? When will it become stable? Are there still some bugs that needs to be fixed?Bilagi
03/07/2019, 7:46 AMfirst_name
, last_name
etc also using Gson
for parsing. Suppose server doesn't send any one of the key value. I am expecting app should crash but it is not crashing. When i degug value is null
.Any one knows what is the reason ?sorianog
03/07/2019, 12:01 PMCarlosBlanco
03/07/2019, 10:32 PMPaul Woitaschek
03/08/2019, 7:17 AMSchadenfreude
03/08/2019, 4:53 PM// Java fun
fun <T:E> registerEvent(cls:Class<T>, consumer: Consumer<T>) : Disposable {
return this.listen(cls)
.subscribe(consumer)
}
// Kotlin fun (calls the java one)
inline fun <reified T:E> registerEvent(consumer: Consumer<T>): Disposable {
return registerEvent(T::class.java, consumer)
}
In java I have no problem calling registerEvernt(SomeClass.class, this::consumerMethod)
, but in Kotlin, when I try to do a method reference for the consumer, the compiler gives me an error and says it returns a KFunction1<SomeClass, Unit>
and the required parameter is Consumer<SomeClass>
. Is there any way I can make the functions behave the same, or is the inline
or something else making it impossible?tapchicoma
03/11/2019, 1:43 PMtapchicoma
03/11/2019, 1:43 PMgumil
03/11/2019, 2:06 PMtapchicoma
03/11/2019, 2:08 PMgumil
03/11/2019, 2:43 PM