Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
tim636373127yAcessing the UI elements with "findById(R.id.xyzview)" is the way to go. You should do that once in onCreate() (Activity) or in onViewCreated() (Fragment) and store the reference in a global variable.
There is no such thing as databinding in Android. -
There is databinding. I personally haven't used it but have read a few things about it. https://developer.android.com/topic...
-
tim636373127y@discosama
I did not know about this. And I have never seen it being used in any project.
Sounds interesting. I will have a look :) -
m4lik687y@tim636373 Once I have learned about it I got used to use databinding. And if you haven't tried it yet, you should give Jake warthon's butter knife a try (@DavidINC you too). Its a view injection library. :)
-
Or if you use Kotlin, look at the Android Extensions. Big fan, of referencing the views using their ID straight in my Kotlin files. But make sure you have some sort of naming conventions for the views
Related Rants
Quick question on Android development. Is it good practice to access UI elements from code, i.e R.id.example? Or is there something similar to WPF's data binding?
question
xml
android development
data binding