Discover surprise Android development knowledge, resources and theory with examples.
Bitmaps can very easily exhaust an app's memory budget. Loading bitmaps on the UI thread can degrade your app's performance, causing slow responsiveness or even ANR. And it even harder if your app is loading multiple bitmaps into memory.
It is therefore important to skillfully manage threading, memory and disk caching when working with bitmaps.
Making adept use of threads & processes on Android can help you boost your app’s performance.
Garbage collection (GC) is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program.
- Garbage Collection Roots—The Source of All Object Trees
- Stop the world event!
- Mark Sweep Compact (MSC)
- Concurrent Mark Sweep (CMS)
A memory leak happens when memory is allocated but never freed. This means the garbage collector is not able to take out the trash once we are done with the takeout. So the memory of our app will constantly increase until no more memory can be allocated to our app, leading to OutOfMemoryError
which ultimately crashes the app
- Unregister listener
- Non-static nested class (inner class)
- Anonymous Class
- Bitmap
- Context
- Resource not closed
The Loader API lets you load data from a content provider or other data source for display in an FragmentActivity or Fragment. It was a solution to a problem that we shouldn’t have really been trying to solve — running asynchronous tasks within a Fragment or Activity and handling the rotation change.
See more
Android is an open source, Linux-based software stack created for a wide array of devices and form factors.
- The Linux Kernel
- Hardware Abstraction Layer (HAL)
- Android Runtime
- System Services
- Native C/C++ Libraries
- Binder IPC
- Java API Framework
- System Apps
Virtual Machine allow Java/Kotlin programs to run on any device or operating system (known as the "Write once, run anywhere" principle), and to manage, optimize program resources & memory.
The APK is built using Java Compiler (javac), DEX compiler (dx), Android Asset Packaging Tool (aapt) and APK Packager.
See more
Android Runtime (ART) is the managed runtime used by applications and some system services on Android. Replacing the predecessor Dalvik, ART performs the translation of the application's bytecode into native instructions that are later executed by the device's runtime environment.
ART also executes the Dex format and Dex bytecode specification.
App components are the essential building blocks of an Android app. Each component is an entry point through which the system or a user can enter your app. Some components depend on others.
A service is a general-purpose entry point for keeping an app running in the background for all kinds of reasons. It is a component that runs in the background to perform long-running operations or to perform work for remote processes.
A service does not provide a UI.
See more
The Java collections framework is a set of classes and interfaces that implement commonly reusable collection data structures.