6. Nov 2020
Android#goodroidtips I. - Tips & tricks for Android developers
A regular section in which I will share with you current and useful tips and tricks from the world of Android development. :)
Do you use Layout inspector tool in Android Studio?
Layout inspector is a great tool for debugging basic layout properties in applications. Just a few clicks to find out why you can't see your view. In version 4.0, a 3D layout inspector was also added to Android Studio, thanks to which you can look at the layout from different angles and debug, for example, the elevation of elements.
How do you approach views on your projects?
We at Goodrequest have been stuck to the use of Kotlin Synthetic for a long time. With the arrival of View Binding we found many benefits and decided to give it a chance. Therefore, we are currently starting new projects using View Binding. And what are the 3 most commonly used techniques in terms of simplicity, security and code size?
- View Binding - easy, compile time safety, without the need for a lot of code
- Kotlin Synthetic - easy, not compile time safety, without the need for a lot of code
- FindViewById - easy but unsustainable, not compile time safety, lot of boilerplate code
We use View Binding and Kotlin Synthetic.
App ratings also for Android!
After a long time, Google finally listened to the wishes of developers and created the Google Play In-App review API. This allows you to conveniently request a review of the application directly in it, without the user having to leave it. The review dialog can be requested at virtually any time, the API itself decides whether to display it or not. For Android developers, this makes work easier. Thanks to this feature, we do not have to write our own conditions when the request for review should be displayed.
Have you also been waiting for this opportunity as I have?
Synchronized keyboard animations!
The new API comes with the ability to synchronize content in the application with sliding and retracting the keyboard. In addition, it is now possible to control system UI (eg System bar), immersive mode and others using the WindowInsetsAnimationController. These options will help us to make our applications a little closer to the design guidelines and thus more intuitive for users. The methods do not yet have a Jetpack version. However, I believe that it will be
added soon!
Embedded emulator directly in Android Studio!
The latest August version of Android Studio brought many improvements. Among other things, it is also possible to run the emulator of the Android device directly in the Android Studio. This feature significantly saves screen space and speeds up navigation between the code editor and the emulator. Embedded emulator currently does not contain all the possibilities of the old emulator, in other versions of AS they will definitely be gradually added. Nevertheless, it is already a change that developers will appreciate. Will you use it or are you waiting for additional options and improvements?
For more #GoodroidTips follow me on LinkedIn, or Twitter profile. :)
I will be happy if you let me know if you like my tips, or if you share topics you would like to see on my profile or our blog.