r/androiddev • u/dayanruben • Jul 23 '20
Article Improving inter-activity communication with Jetpack ActivityResult
https://android-developers.googleblog.com/2020/07/jetpack-activityresult.html10
u/3dom test on Nokia + Samsung Jul 23 '20
Every time I see Android constructs like
val getContent = registerForActivityResult(GetContent()) { uri: Uri? ->
// Handle the returned Uri
}I think "will I have to nullify them in onPause and re-assign in onResume?". Android click listeners scarred me for life.
8
3
u/prateeksaraswat Jul 24 '20
For my understanding - why is this important?
4
u/3dom test on Nokia + Samsung Jul 24 '20 edited Jul 24 '20
They may cause memory leaks.
edit: added link.
3
2
u/drabred Jul 24 '20
You do that with click listeners?
2
u/3dom test on Nokia + Samsung Jul 24 '20
No, today view binding took the mandatory nulification role. But at least it's semi-automated.
1
u/pawarprasad37 Jul 24 '20
So the official blogs also have mistakes! Are these blogs not proof read?
1
15
u/chimbori 🐚 Hermit Dev Jul 23 '20
Good to see Jetpack essentially fixing core Android APIs and redoing them the way they should've been done originally.