Sudhir Singh Khanger
07/03/2021, 8:51 AMLiveData
object returns a non-null type would it at all trigger an observer's onChange()
if there is no data to be served?
val someLiveData: LiveData<List<String>> = ...
val someObserver = { someValue: String ->
// Will this return only if there is non-null data in someLiveData
}
B. Same case as above except the observer class expects a nullable type. So if LiveData
returns non-null type but the observer object expects a nullable type then would we get a null value when there's nothing to be returned?
val someLiveData: LiveData<List<String>> = ...
val someObserver = { someValue: String? ->
// Will this return null value from a non-null LiveData
}
Robert Munro
07/04/2021, 12:05 AM:app:compileDebugUnitTestKotlin
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/testDebug/kotlin', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/testDebug/java', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/testDebug/java', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/testDebug/kotlin', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/testDebug/java', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/testDebug/java', not found
Transforming YouTubeAndroidPlayerApi.jar with JetifyTransform
Transforming YouTubeAndroidPlayerApi.jar with IdentityTransform
Transforming YouTubeAndroidPlayerApi.jar with JetifyTransform
Transforming YouTubeAndroidPlayerApi.jar with IdentityTransform
Using Kotlin/JVM incremental compilation
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/test/kotlin', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/test/kotlin', not found
file or directory '/Users/robmunro/repos/personal/cuer/cuer/app/src/test/kotlin', not found
i: found daemon on port 17524 (224945 ms old), trying to connect
i: connected to the daemon
Options for KOTLIN DAEMON: IncrementalCompilationOptions(super=CompilationOptions(compilerMode=INCREMENTAL_COMPILER, targetPlatform=JVM, reportCategories=[0], reportSeverity=2, requestedCompilationResults=[0]kotlinScriptExtensions=[kt, kts, java, java, java]), areFileChangesKnown=false, modifiedFiles=null, deletedFiles=null, workingDir=/Users/robmunro/repos/personal/cuer/cuer/app/build/kotlin/compileDebugUnitTestKotlin, multiModuleICSettings=MultiModuleICSettings(buildHistoryFile=/Users/robmunro/repos/personal/cuer/cuer/app/build/kotlin/compileDebugUnitTestKotlin/build-history.bin, useModuleDetection=true), usePreciseJavaTracking=trueoutputFiles=[/Users/robmunro/repos/personal/cuer/cuer/app/build/tmp/kotlin-classes/debugUnitTest, /Users/robmunro/repos/personal/cuer/cuer/app/build/kotlin/compileDebugUnitTestKotlin])
AAPT2 aapt2-7.0.0-beta04-7396180-osx Daemon #0: shutdown
<============-> 98% EXECUTING [4h 43m 44s]
IDLE
IDLE
IDLE
appcompileDebugUnitTestKotlin
Maku Mazakpe
07/04/2021, 8:06 AMQvK23
07/05/2021, 1:18 AM@Synchronized
fun abc() {
// do some heavy tasks in multiple threads
}
In the document `@Synchronized`is thread safe annotation but I wonder that Should I use multiple thread operations inside function abc()
?Sololo
07/05/2021, 6:33 AMDerek Ellis
07/05/2021, 1:25 PMlifecycleScope
in an activity's onDestroy()
since the scope only spans until onDestroy()
is called, right? What would be a suitable alternative to launch a coroutine to do some kind cleanup job that shouldn't be immediately canceled when the activity is destroyed? MainScope
?Edidiong Aligve
07/05/2021, 2:46 PMJuango
07/05/2021, 7:06 PMCompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text("3 minutes ago", style = MaterialTheme.typography.body2)
}
Vivek Modi
07/06/2021, 9:01 AM<string name="data">%1$s / %2$s</string>
i pass varargs
in function like that
fun getText(varargs text: String){
getString(R.string.data,text)
}
I called function
getText("1" ,"2")
It gives error
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.vivek, PID: 5126
java.util.MissingFormatArgumentException: Format specifier '%2$s'
at java.util.Formatter.format(Formatter.java:2529)
at java.util.Formatter.format(Formatter.java:2459)
at java.lang.String.format(String.java:2911)
Viral Thakker
07/06/2021, 11:32 AMharis mehmood
07/07/2021, 5:20 AMJørgen Heinsen
07/07/2021, 9:38 AMNitish Sharma
07/07/2021, 9:43 AMPavlo Zoria
07/07/2021, 12:28 PMMaku Mazakpe
07/08/2021, 4:02 PMPeter Mandeljc
07/08/2021, 7:00 PMclass SelectFileUseCase @Inject constructor(
@ApplicationContext private val context: Context
) {
operator fun invoke(): Uri {
val intent = Intent().apply {
type = "file/*"
action = Intent.ACTION_GET_CONTENT
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(intent)
// how to get result??
context.registerReceiver(receiver, filter) // maybe?
}
}
frankelot
07/08/2021, 10:46 PMMap
implementation of mutableStateMapOf()
?haris mehmood
07/09/2021, 7:02 AMYves Kalume
07/09/2021, 11:51 AMmelatonina
07/09/2021, 6:04 PMNoushad Chullian
07/10/2021, 2:32 PMspierce7
07/10/2021, 3:51 PMJohn O'Reilly
07/11/2021, 9:30 AMandroidx.datastore:datastore-preferences:1.0.0-rc01
and seeing occasional crashes in play console (stack trace in thread) but can't reproduce locally....just in case anyone else has encountered this.FunkyMuse
07/11/2021, 2:35 PMHUONG
07/12/2021, 8:48 AMHovhannes
07/12/2021, 2:27 PM{
"users": [
{
"id": "1",
"name": "Bill Roy",
},
{
"id": "2",
"name": "Ben Bush",
},
{
"id": "3",
"name": "Dan Fox",
},
]
}
User.kt
data class User(
@Json(name = "id")
val id: Int = 0,
@Json(name = "name")
val name: String = "",
@Json(name = "users")
val userList: List<User>
)
ApiService.kt
interface ApiService {
@GET("getUsers")
suspend fun getUsers(): Response<List<User>>
}
atanasi charle
07/12/2021, 8:22 PMAbhishek K
07/13/2021, 5:50 AMmelatonina
07/13/2021, 9:32 AMRak
07/13/2021, 11:20 AM