Dababase Stuff with Room
What a nice room! Room is an ORM which runs on Android and persists its data into an sqlite database.
What a nice room! Room is an ORM which runs on Android and persists its data into an sqlite database.
import android.os.StrictMode import android.os.StrictMode.ThreadPolicy import android.os.StrictMode.VmPolicy class LevelUpApplication : Application() { override fun onCreate() { if (BuildConfig.DEBUG) { StrictMode.setThreadPolicy( ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build() ) StrictMode.setVmPolicy( VmPolicy.Builder() .detectLeakedSqlLiteObjects() .detectLeakedClosableObjects() .penaltyLog() .penaltyDeath() .build() ) } super.onCreate() https://developer.android.com/reference/android/os/StrictMode
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 {…
I’ve integrated a QRCode scanner into my app and it worked fine on my old Android 5 device but throws the error Camera: Camera new cameraInitNormal:-13 on Android 8. To fix this You have to integrate some code to check if permission is already granted by the user and in case it is not, request…
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…
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”…
Boy Scout rule You may know the boy scout rule: Always leave the campground cleaner than you found it! So, when there is some litter: pick it up. Boy Scout rule in Clean Code Always leave the code you are editing a little bit better than you found it If there is no documentation, write…
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
As mentioned in What is ProGuard? R8 is the new kid on the block for shrinking and optimizing code. App Gradle android { buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile( ‘proguard-android-optimize.txt’), ‘proguard-rules.pro’ } } https://developer.android.com/studio/build/shrink-code
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…