https://kotlinlang.org logo
#android
Title
# android
j

Jorge Castillo

09/24/2017, 4:02 PM
One rapid question here. I’m trying to do synthetic import for a layout included in a different gradle module (a dependency of the app module)
d

dragas

09/24/2017, 8:11 PM
Personally I'd avoid synthetic imports all together. As far as I remember that anko has
findViewById<T>(int)
which returns either that element or null, if it's not available. Then again, that's coming from Kotlin 1.0.5EAP
j

Jorge Castillo

09/24/2017, 9:18 PM
Why would you use that when you can use the reference directly?
r

rwachol

09/25/2017, 10:05 AM
findViewById return correct type for new build tools afaik
d

dragas

09/25/2017, 3:41 PM
Why wouldn't you? It saves you the headache when diagnosing
InvalidCastException
issues.
j

Jorge Castillo

09/25/2017, 6:13 PM
For the same reasons why you pick butterknife. You want to get rid of the view fetching boilerplate to avoid writing it all the time.
Using anko for that has no big difference with using the standard Android findViewById