Skip to content

Instantly share code, notes, and snippets.

@sallySalem
sallySalem / AndroidClass.kt
Created February 11, 2018 18:11
Use Kotlin extension function instead of `compose()` in java to reuse the code of schedulers in Rxjava
//So no need to inject ioScheduler or computationScheduler
Observable.just("").applyIoScheduler()
Observable.just("").applyComputationScheduler()
Flowable.just("").applyIoScheduler()
Flowable.just("").applyComputationScheduler()
Single.just("").applyIoScheduler()
Single.just("").applyComputationScheduler()
@sallySalem
sallySalem / SortCustomList.kt
Created February 11, 2018 17:36
Sort a list of custom object in Kotlin
//Sort Descending
customList.sortByDescending(CustomModel::date)
.apply {
view?.loadCustomList()
}
//Sort Ascending
customList.sortBy(CustomModel::date)
.apply {
view?.loadCustomList()
@sallySalem
sallySalem / README.md
Created January 1, 2018 11:55 — forked from lopspower/README.md
How to Analyze & Manage Memory on Android Like a Boss

Analyze & Manage Memory on Android Like a Boss

This Blog is all about memory management in Android. It provides information about how you can analyze & reduce memory usage while developing an Android app.

Memory management is a complex field of computer science and there are many techniques being developed to make it more efficient. This guide is designed to introduce you to some of the basic memory management issues that programmers face.

Memory Management in Android

Android is a Linux based operating system. It uses native open source C libraries which power Linux machines. All the basic operating system operations like I/O, memory management and so on are handled by the Linux kernel. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the lifetime processes. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memo