Alexanderkvamme
03/19/2020, 8:34 AMcmd+y
did this, but i cant seem to find an equivalent.rattleshirt
03/19/2020, 4:16 PMcompileDebugAndroidTestKotlin
task having compilation error with Unresolved reference: id
when using it in androidTest withId(R.id..)
?Marc Knaup
03/20/2020, 10:49 AMShreyas Patil
03/20/2020, 1:13 PMGalou Minisini
03/20/2020, 3:21 PMBruno_
03/21/2020, 10:58 AMupdate publisher
(new items are being pushed into it)
• refresh the view model data every let's say 1s
• try to implement it so that if the user get's to the end of the list, more items are loadedSlackbot
03/21/2020, 4:56 PMSlackbot
03/22/2020, 1:35 PMSourabh Rawat
03/22/2020, 3:55 PMCursor
when trying to get audio files from MediaStore
. ANy help?Joshua
03/22/2020, 3:56 PMapp:logo="@{viewModel.toolbarViewConfig.isMenuVisible}"
but I get the error
Cannot find a setter for <androidx.appcompat.widget.Toolbar app:logo> that accepts parameter type androidx.lifecycle.MutableLiveData<java.lang.String>
If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.
I somehow want to set the app:logo to empty. I tried it here:
viewModel.toolbarViewConfig.isMenuVisible.value = ""
Arslan Mushtaq
03/23/2020, 8:26 AMEslam Hussein
03/23/2020, 12:00 PMEllen Spertus
03/23/2020, 8:56 PMActivityInfo.exported
with Mockito. Here’s the relevant part of my code:
private fun makeResolveInfo(appName: String, packageName: String, exported: Boolean = true) : ResolveInfo {
val activityInfo = mock(ActivityInfo::class.java)
`when`(activityInfo.exported).thenReturn(exported)
// code omitted
}
The error is:
org.mockito.exceptions.misusing.MissingMethodInvocationException:
when() requires an argument which has to be 'a method call on a mock'.
For example:
when(mock.getArticles()).thenReturn(articles);
Also, this error might show up because:
1. you stub either of: final/private/equals()/hashCode() methods.
Those methods *cannot* be stubbed/verified.
Mocking methods declared on non-public parent classes is not supported.
2. inside when() you don't call method on mock but on some other object.
Here is the javadoc for the exported
getter (which is in ComponentInfo
, which ActivityInfo
extends): https://developer.android.com/reference/android/content/pm/ComponentInfo#exportedriflockle
03/24/2020, 6:11 AMandroid test
source code
// AnyTest.kt
@Test
fun callStackCrop_a() = runBlocking {
a(0)
a(1)
a(2)
a(3)
a(10)
***a(11)*** // 76 line
a(12)
}
suspend fun a(x: Int): Unit = b(x) // this action cropped....
suspend fun b(x: Int) = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
c(x) // 82 line
}
suspend fun c(x: Int) {
if (x > 10) {
throw NullPointerException("ops x = ${x} > 0") // 86 line
}
}
Test result is that
at ___.AnyTest.c(AnyTest.kt:86)
at ___.AnyTest$b$2.invokeSuspend(AnyTest.kt:82)
at |b|b|b(Coroutine boundary.|b(|b)
at ___.AnyTest$koroChase$1.invokeSuspend(AnyTest.kt:76)
Caused by: java.lang.NullPointerException: ops x = 11 > 0
at ___.AnyTest.c(AnyTest.kt:86)
at ___.AnyTest$b$2.invokeSuspend(AnyTest.kt:82)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
"Calling b() method
at a()
" is removed…..
I want to see all call stack trace
in coroutine
how to recover this call stack.....?
Attach a link with a similar problem
https://github.com/Kotlin/kotlinx.coroutines/issues/1660iex
03/24/2020, 1:54 PMfun Fragment.onBack(consume: Boolean = false, callback: () -> Unit) {
activity?.onBackPressedDispatcher?.addCallback {
callback()
if (!consume) {
findNavController().navigateUp()
}
}
}
Works perfectly when I don't want to consume the event. It also works when I consume it, except that after it the back button is dead. How do I consume only the current back press?Travis Griggs
03/24/2020, 5:55 PMassert()
to do something meaningful. I note that I’m supposed to run the JVM with -ea
(as per https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/assert.html). But where do I actually do that at?Galou Minisini
03/24/2020, 8:20 PMOfir Bar
03/24/2020, 10:17 PMColton Idle
03/24/2020, 10:32 PM182630g
03/25/2020, 2:42 AMjaran
03/25/2020, 8:17 AM2020-03-25 09:16:27,867 [566297214] WARN - ConfigurableExtensionPointUtil - ignore deprecated groupId: language for id: preferences.language.Kotlin.scripting
2020-03-25 09:16:27,870 [566297217] WARN - ConfigurableExtensionPointUtil - use other group instead of unexpected one: project.propCompiler
2020-03-25 09:16:28,095 [566297442] INFO - j.ide.plugins.RepositoryHelper - using cached plugin list (updated at 25/03/2020, 09:10)
2020-03-25 09:16:28,306 [566297653] WARN - llij.ide.plugins.PluginManager - 4.0 not loaded: since build 193.5233.102 > AI-192.7142.36.36.6241897
antoniomarin
03/25/2020, 10:21 AMonConfigurationChanged
?
I’m dealing with the locales, and when I do update it manually I need to somehow recreate
the views, recreating activity will kick user out and he will need to re-log so I would rather try to avoid that.
I’m also trying with the following but it doesn’t work completely which is weird in fairness:
val res = resources
val configuration = res.configuration
configuration.setLocale(Locale(preferences.userLocale))
onConfigurationChanged(configuration)
Mark
03/25/2020, 12:08 PMinit {
someInstance.someVal = { someHelper.someFun(it) }
}
and LeakCanary hinted that this was causing a leak, so (as a complete stab in the dark) I switched to using a method reference and the leak seemed to go away. Can anyone explain why such a seemingly minor change could fix a leak, please?
init {
someInstance.someVal = someHelper::someFun
}
Olle
03/25/2020, 2:17 PMclass file for kotlin.jvm.internal.markers.KMappedMarker not found
whenever im compiling the project implementing the library. I’ve added the kotlin stdlib to the library as a dependecy like so:
api("org.jetbrains.kotlin:kotlin-stdlib:1.3.71")
It does compile if i add kotlin to the project implementing the library but we would like to avoid that if possible.
any tips/pointers would be appriciated, Thanks!Cody Engel
03/25/2020, 5:32 PMSagar Suri
03/26/2020, 1:57 AMChung
03/26/2020, 1:57 AMtabFragmentsCreators
variable https://github.com/android/sunflower/blob/master/app/src/main/java/com/google/samples/apps/sunflower/adapters/SunflowerPagerAdapter.kt#L32
What is the benefit of using a Map<Int, () -> Fragment>
instead of just Map<Int, Fragment>
Benyam Seifu
03/26/2020, 6:01 AMadeyds
03/26/2020, 7:57 AMunresolved reference
Ellen Spertus
03/26/2020, 6:49 PMEllen Spertus
03/26/2020, 6:49 PMtseisel
03/27/2020, 8:23 AMSharedPreferences
.
I think it would be easier to use Robolectric Shadows.