AmrJyniat
11/23/2021, 8:36 AMzain
11/23/2021, 12:45 PMKatarzyna
11/24/2021, 8:48 AMVivek Modi
11/24/2021, 4:45 PMval string = "000010"
or val string = "010"
to get only 10
Mehdi Haghgoo
11/24/2021, 4:58 PMRajput Art Studio
11/24/2021, 5:57 PMRicha
11/25/2021, 5:53 AMNemanja Scepanovic
11/25/2021, 10:38 AMjava.lang.ClassCastException: java.lang.String cannot be cast to Query
and I am completely puzzled to why is that?
I get that value classes are “deconstructed” to the primitive type in runtime, but why am I then allowed to use them like this then?
Thanks!Vivek Modi
11/25/2021, 12:38 PMAidan Low
11/25/2021, 5:06 PMLilly
11/26/2021, 12:38 AMinternal
visibility modifier.
Is it intended that test classes from app/src/test/java/ can access internal classes from app/src/main/java? If yes, can someone tell me why Android Studio marks those references as unresolved? The test runs without any problems!
It's a fresh android project.
Android Studio Chipmunk | 2021.2.1 Canary 5
Build #AI-212.5457.46.2112.7905983, built on November 11, 2021
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.andrey4623.rainbowcsv (2.0), Statistic (4.1.7), com.github.setial (4.0.2), CheckStyle-IDEA (5.58.0), dev.polek.adbwifi (1.2.4), krasa.CpuUsageIndicator (1.14), kotest-plugin-intellij (1.1.44-IC-2021.1), izhangzhihao.rainbow.brackets (6.21)
myanmarking
11/26/2021, 12:43 PMRaul Macías
11/26/2021, 7:19 PMMehdi Haghgoo
11/27/2021, 11:44 AMjava.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.I'm doing all insertions in coroutine contexts like:
fun removeMessage(message: Message) = viewModelScope.launch{
repository.remove(message)
}
Arpit Shukla
11/28/2021, 4:33 AMMap<String, Any>
to a data class using kotlinx.serialization?Akash
11/29/2021, 11:21 AMTower Guidev2
11/29/2021, 3:10 PMamiracam
11/29/2021, 10:45 PMMahmoud
11/30/2021, 8:10 AMAnkit Shah
11/30/2021, 5:03 PMAlexander Black
11/30/2021, 7:08 PMjava.lang.ClassCastException: java.util.ArrayList cannot be cast to kotlin.Resul
? Should I report this as a bug? I’m able to use the Kotlin result library without issue for many result types, but weirdly not with lists. I’m simply trying to return a result from an API request as a list, but having trouble doing so.
My method looks like this
suspend inline fun <reified T> get(route: String,
block: RequestBuilder.() -> Unit = {}): Result<T> {
if (networkReachability.isNetworkAvailable) {
return try {
val options = RequestBuilder().apply(block)
val response = client.get<T>("$baseUrl$route") {
headers {
sessionId.value?.also {
append("API-KEY", it)
}
}
if (options.requestPerms.isNotEmpty()) {
options.requestPerms.forEach {
// this sets the URL query parameters
this.parameter(it.first, it.second)
}
}
}
Result.success(response)
} catch (e: Exception) {
return handleError(e)
}
} else {
return Result.failure(NetworkNotReachable)
}
}
my T
type in this case is a ListAhmed Hassan
11/30/2021, 10:41 PMnullableVarParent?.let { nonNullParent ->
if (
nonNullParent.nullableValChildOne == null
|| nonNullParent.nullableValChildTwo == null
)
return
funcEx(
nonNullParent.nullableValChildOne,
nonNullParent.nullableValChildTwo
)
}
2nd Block
if (
nullableVarParent?.nullableValChildOne == null
|| nullableVarParent?.nullableValChildTwo == null
)
return
funcEx(
nullableVarParent?.nullableValChildOne!!,
nullableVarParent?.nullableValChildTwo!!
)
Some would think the second one is safe too because of the if condition, but is it better to use?
Appreciate your support.Lilly
12/01/2021, 12:23 AM'public' function exposes its 'internal' parameter type...
internal interface Cache
// Public API
class API(private val cache: Cache) { // compile error --> 'public' function exposes its 'internal' parameter type
// Cache is not exposed, just used internally
}
Cache
is not part of the public API but it is used in the class that represents the public API (public API of the library/module). What options do I have?Colton Idle
12/01/2021, 6:06 AMRemy Benza
12/01/2021, 12:57 PMiamraghavawasthi
12/02/2021, 5:07 AMdave08
12/02/2021, 10:20 AM@Nullable
for that... 🤔dave08
12/02/2021, 10:23 AM@Override
public int getInt(String key, int defValue) {
synchronized (mLock) {
awaitLoadedLocked();
Integer v = (Integer)mMap.get(key);
return v != null ? v : defValue;
}
}
natario1
12/02/2021, 4:09 PMkotlin.Metadata
+ proguard after updating to 1.6.0? We were following official advice, but now the annotation is not kept in bytecode anymore, which creates all sorts of issues.Ankit Shah
12/02/2021, 5:21 PM@Composable
fun FollowInterestsContent(actions: MainActions,viewModel:UserOnboardViewModel){
val coroutinesScope = rememberCoroutineScope()
viewModel.setInterestsList(context)
}
This Returns Suspend function 'setInterestsList' should be called only from a coroutine or another suspend function
Next I tried is
@Composable
fun FollowInterestsContent(actions: MainActions,viewModel:UserOnboardViewModel){
val coroutinesScope = rememberCoroutineScope()
coroutinesScope.launch { viewModel.setInterestsList(context) }
}
This Returns Calls to launch should happen inside a LaunchedEffect and not composition