Ali
01/28/2022, 5:14 PMCaused by android.os.BadParcelableException: Parcelable protocol requires subclassing from Parcelable
is happening even my data class implement Parcelable
interface and annotate with @Parcelizee
, Any kind of hints/context would be appreciatedRahul Gill
01/28/2022, 6:07 PMFlow
emit new value on some event(for example emitting new list when an item is added to the listVivek Modi
01/28/2022, 10:48 PMval string = "Check out this property I found using Daft
<https://www.daft.ie>"
Output
<https://www.daft.ie>
Utkarsh Tripathi
01/29/2022, 6:08 AMDevanshu Kaushik
01/29/2022, 8:03 AMA
and data class D
such that :
abstract class A {
//other fields
open val qty: Int?
}
data class D(
//other fields
override val qty: Int?
): A()
now, when I use class D
for auto-serializing my JSON response using gson
, I get the following error:
java.lang.IllegalArgumentException:class D declares multiple JSON fields named qty
if I’m overriding qty
- won’t it mean that there is actually only one field called qty
?Fedora
01/30/2022, 2:48 PMSlackbot
01/30/2022, 3:54 PMRemon Shehata
01/30/2022, 6:20 PMNathaniel Rowe
01/30/2022, 10:32 PMtypealias NavEventListener<T> = (T) -> Unit
class NavEventDispatcher<T> {
var listeners = mutableListOf<NavEventListener<T>>()
fun dispatchEvent(value: T) {
listeners.forEach {
it(value)
}
}
}
@Composable
fun <T> HandleNavEvent(dispatcher: NavEventDispatcher<T>, listener: NavEventListener<T>) {
DisposableEffect(dispatcher) {
dispatcher.listeners.add(listener)
onDispose {
dispatcher.listeners.clear()
}
}
}
Basically, a screen composable calls HandleNavEvent(viewModel.dispatcher) { eventPayload -> onNavigate(...) }
, and the view model simply adds a dispatcher instance. I have this dispatcher as a second public property of the view model alongside a single state flow describing the UI state. My question is, is there a better way to do this? It seems to work for the most part, I'm new to compose and am wondering if there is anything I'm not considering here.
The motivation for this is my architecture has it such that, if we just navigate by watching the UI state, then when we navigate back, you bounce right back to the second screen because the UI state for the previous screen is still one which means "navigate forward". I needed a way to reset the state, and didn't want to have a requirement that all my UI states have a "reset" method which resets only part of it. I figured separating the UI state from the navigation state was the way to go.Kiki Abdullah
01/31/2022, 5:59 AMclass MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val rollButton: Button = findViewById(R.id.roll_button)
rollButton.setOnClickListener { clickMe() }
}
private var word = listOf("Bla", "Blabla", "Yo", "Go")
private fun clickMe() {
val resultText: TextView = findViewById(R.id.result_text)
val listIndex = 0
resultText.text = word[listIndex]
listIndex + 1
}
}
Sorry for this stupid question, I mean to show "Bla" on first click, "Blabla" on second click and so on. but when I run the app, the screen only shows "Bla" even on second or next click. Thanks in advanceChethan
01/31/2022, 10:23 AMPriya
01/31/2022, 2:43 PMVivek Modi
01/31/2022, 3:38 PM1.5.1
to 1.6.0
in my project.Ali
01/31/2022, 4:58 PMoverride fun getUpdates(): Observable<Model>
How can I handle this from the presenter layer using kotlin coroutines? I need scheduler in the presenter layer.eRajput Art Studio
01/31/2022, 5:02 PMLukasz Kalnik
01/31/2022, 5:29 PMViewModel.onCleared()
? It is protected, so cannot be called from tests... I cancel some coroutines jobs there and have to call it at the end of my test. I'm thinking about adding a separate method just for tests which calls onCleared()
internally, but it seems quite ugly.Guilherme Lima Pereira
01/31/2022, 7:07 PMandroid.nonTransitiveRClass=true
? I’m wondering what to do with include layout on xml referring a layout from another gradle module, when using databinding.Scott Kruse
01/31/2022, 7:18 PMSlackbot
02/01/2022, 8:43 AMtylerwilson
02/01/2022, 8:22 PMursus
02/01/2022, 10:01 PMsdkmanager
on CI, but I get
sdkmanager "build-tools;30.0.3"
Warning: Dependant package with key emulator not found!
Warning: Unable to compute a complete list of dependencies.
/ # ] 10% Computing updates...
anybody has a clue please?jasu
02/03/2022, 6:52 AMbut don't say I didn't warn you!).
Such a message in exception gives reason to smile 🙃andreasmattsson
02/03/2022, 2:19 PMAli
02/03/2022, 3:08 PMtotal
with the value for this string: "%{total} price for the Pizza"
Irene Serrano
02/04/2022, 12:12 AMSlackbot
02/04/2022, 12:44 PMRafiul Islam
02/05/2022, 8:44 AMcom.android.application
in my module level gradle file.
plugins {
id 'com.android.application' version '7.0.0-alpha13' apply false
}
And I don' see any dependencies block like
{
classpath('com.android.tools.build:gradle:7.0.0-alpha13')
}
Don't we need this anymore? How my new project is getting android gradle plugin?George Pandian
02/05/2022, 2:10 PMorg.gradle.api.initialization.Settings.DEFAULT_SETTINGS_FILE
It’s a final value which I understand to an extent why , however if I want the settings of the root project to use settings of a buildSrc module I write how can I change it ?
I would like to set in my root settings.gradle.kts the name of the DEFAULT_SETTINGS_FILE to “buildSrc/settings.gradle.kts”.
Any help appreciated 🙂 also thought on this appreciated more 🙂spierce7
02/05/2022, 8:45 PMArjun Achatz
02/06/2022, 3:26 AMArjun Achatz
02/06/2022, 3:26 AMIan Lake
02/06/2022, 3:49 AMUsing Kotlin to build Android apps. Avoid :not-kotlin:.
:not-kotlin: questions should go here: 😒tackoverflow:; https://discord.com/invite/D2cNrqX, or http://android-united.community/, or https://androidchat.co/
therealbluepandabear
02/06/2022, 4:01 AM