Useful Codes

Useful Codes

Jan. 16, 2019 by

Useful for small background tasks // Declear in class private final Handler handler = new Handler(); new Thread(new Runnable() { @Override public void run() { // Try to sleep the thread for 20 milliseconds try { Thread.sleep(20); //3 seconds }

RxJava2

RxJava2

Jan. 14, 2019 by

Converting callback async calls to RxJava APIs usually offer one of these two options when dealing with expensive operations: A synchronous blocking method call (expected to be called from a background thread) An asynchronous non-blocking method call that uses callbacks (and/or listeners, broadcast receivers, etc)

Must Have Libraries For Android Developer

Must Have Libraries For Android Developer

Jan. 11, 2019 by

There are many third-party libraries for Android but several of them are “must have” libraries that are extremely popular and are often used in almost any Android project. Each has different purposes but all of them make life as a

Android Gradle

Android Gradle

Jan. 9, 2019 by

How to recompile with -Xlint:deprecation adding this to build.gradle allprojects { … gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << “-Xlint:deprecation” } } } Removing unused resources and Java classes via resource shrinking The Gradle build system for Android supports resource shrinking at

Libs And Tools

Libs And Tools

Jan. 5, 2019 by

EasyFlipViewPager https://github.com/wajahatkarim3/EasyFlipViewPager Hauler Hauler is a library containing custom layout which enables to easily create swipe to dismiss Activity. Implementation is based on code from project Plaid. https://github.com/thefuntasty/hauler Easy CSV Creates csv file for android https://github.com/hsmnzaydn/easy-csv Text Scanner from image This library

Shared element transitions in activities and fragments

Shared element transitions in activities and fragments

Dec. 13, 2018 by

Transitions between activities and fragments in Android involved animating the entire view hierarchy. However, with Material Design, it is now easier to animate selected Views during a transition to emphasize continuity, and guide users to content in the target Activity/Fragment.

Sample Post

Sample Post

Dec. 12, 2018 by

Atelier Forest Light @Entity public class User { @PrimaryKey public int uid; @ColumnInfo(name = “first_name”) public String firstName; @ColumnInfo(name = “last_name”) public String lastName; } Atelier Sulphurpool Light @Entity public class User { @PrimaryKey public int uid; @ColumnInfo(name = “first_name”)

Android Room Migration

Android Room Migration

Dec. 12, 2018 by

Scenario 1: keep the database version unchanged — app crashes java.lang.IllegalStateException: Room cannot verify the data integrity. Looks like you’ve changed schema but forgot to update the version number. You can simply fix this by increasing the version number. Scenario 2: version

Android Room Database

Android Room Database

Dec. 12, 2018 by

Save data in a local database using Room Room provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite. There are 3 major components in Room: Database: Contains the database holder and serves

Manifest Merge Rule

Manifest Merge Rule

Dec. 12, 2018 by

Merge multiple manifest files Your APK file can contain just one AndroidManifest.xml file, but your Android Studio project may contain several—provided by the main source set, build variants, and imported libraries. So when building your app, the Gradle build merges all manifest