79123005

Date: 2024-10-24 17:14:35
Score: 1.5
Natty:
Report link

To safely cast an Activity to ComponentActivity, I usually create an extension function like this:

fun Activity.asComponentActivity(): ComponentActivity? {
    return this as? ComponentActivity
}

So then I use this to call this registerForActivityResult.

This should be fixed from AS as @Ekalips is saying.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Ekalips
  • Low reputation (0.5):
Posted by: Vuki Limani