Replace findViewById with View Binding

Perhaps you have code that looks like that: val mImageView = findViewById<ImageView>(R.id.img_view) mImageView.setOnClickListener(View.OnClickListener This has worked properly over the last years but what are the drawbacks? Or what are the promises of the new View Binding concept? View Binding is always null-safe and type-safe It compiles faster Gradle Enable View Binding in gradle: android {…

Experiments for Remote Teams

As you might know I am a fan of Management 3.0 and especially the celebration grid. The main idea is to do experiments to find out what’s working and what’s not. So when the pandemic started and our team went into full remote we did some experiments. First minutes of Daily dedicated to chit chat…

How to create a signed App Bundle

Motivation When you are building an Android App you finally want to publish it in the Google Play Store. To achieve this you need to build an signed app bundle in Android Studio first Settings Select build variant “release” Go to Build -> Select Build Variant Now a new tool window becomes visible. Select “release”…

What is the AOSP?

AOSP is the Android Open Spurce Project Architecture Source Code is hosted here: https://android.googlesource.com/platform/manifest Google uses repo (basically a git wrapper written in python) to clone the source code. You can find the instructions here:  https://source.android.com/setup/build/downloading Further Reading What is Ninja? What is kapt? Anatomy of a Gradle file

What is ProGuard?

Perhaps you noticed the file proguard-rules.pro in your app directory? Why do we need that? ProGuard ProGuard has three use cases: shrinking obfuscating optimizing Code shrinking Often called “tree shaking”, shrinking optimizes the byte code by removing unused code. Resource shrinking After code shrinking all non-referenced resources will be removed as well Obfuscation This step…

How to use Snackbars

A Snackbar is a replacement for Toasts in Android. Dependency implementation ‘com.google.android.material:material:1.4.0’ Layout A snackbar must be tied to a coordinator layout. If you use fragments the standard layout is FrameLayout which can be directly swapped with: <androidx.coordinatorlayout.widget.CoordinatorLayout Snackbar val snackbar = Snackbar.make( binding.root, “No internet connection! Please enable WiFi or Mobile Data”, Snackbar.LENGTH_INDEFINITE )…