Saturday, 28 January 2017

Android Top 10 Important libraries, keep code you with the best practices


Android Top 10 Important libraries which helps us to maintain the good code practices in general.
Gson: Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of. 

Retrofit, OkHTTP, Loopj: Retrofit is a type-safe REST client for Android (or just Java) developed by Square. The library provides a powerful framework for authenticating and interacting with APIs and sending network requests with OkHttp.  OkHttp is easy. Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with call-backs.  Loopj is an Android library for making asynchronous HTTP requests. I like it for its ease of use and simplicity. Created by James Smith, it's also known as "Android Asynchronous HTTP Client", and it's used by companies like Instagram, Pinterest, and many others. It's a good entry point to the world of HTTP libraries, and will help you understand important concepts very easily.

Otto:  Otto is an event bus designed to decouple different parts of your application while still allowing them to communicate efficiently.  Forked from Guava, Otto adds unique functionality to an already refined event bus as well as specializing it to the Android platform.

Realm: Realm is a mobile database and a replacement for SQLite. Although is an OO database it has some differences with other databases. Realm is not using SQLite as its engine. Instead it has own C++ core and aims to provide a mobile-first alternative to SQLite. Realm store data in a universal, table-based format by a C++ core. This is what allows Realm to allow data access from multiple languages as well as a range of ad hoc queries.

Universal Image Loader, Picasso, Glide & Fresco:  These libraries are powerful, flexible and highly customizable instrument for image loading, caching and displaying. It provides a lot of configuration options and good control over the image loading and caching process.

Dagger2, Butterknife: Dagger 2 analyses these dependencies for you and generates code to help wire them together. While there are other Java dependency injection frameworks, many of them suffered limitations in relying on XML, required validating dependency issues at run-time, or incurred performance penalties during start-up. Dagger 2 relies purely on using Java annotation processors and compile-time checks to analyse and verify dependencies. It is one of the most efficient dependency injection frameworks built to date.   Butterknife, Field and method binding for Android views which uses annotation processing to generate boilerplate code for you.

LeakCanary:  The memory leak can be a headache to detect and to resolve, small memory leaks can be hidden and may be seen after a long usage of the application and hunting memory leaks is not a simple task. 

Databinding MVVM: Android offers support to write declarative layouts using data binding. This minimizes the necessary code in your application logic to connect to the user interface elements.

RxJava & RxAndroid: This module adds the minimum classes to RxJava that make writing reactive components in Android applications easy and hassle-free. More specifically, it provides a Scheduler that schedules on the main thread or any given Looper.

MPAndroidChart: Using these libraries, drawing charts on Android could never be simpler. MPAndroidChart library works on Android API 8 and above, but if you are using animations, it works on API 11 and above. Animations is one of the greatest features apart from easy data input, this library could have. Somehow I feel animations give good user experience to an application. Through MPAndroidChart library, we can use more than 25 inbuilt animations, also can define custom animations.

Sunday, 8 January 2017

Android What? Why? Need of Constraint Layout



What is Constraint Layout?

Constraint Layout ("CL") is the latest addition to Android’s collection of layouts. Constraint Layout is a layout that will feel very similar to RelativeLayout at first glance, CL is more powerful and versatile. CL aims to make developing layouts easier, faster, and more intuitive, while improving performance at runtime. If you are interested in speeding up your development time using the updated Layout Editor ("LE").

Why do we need Constraint Layout?

Speed!!! In many ways, the development of CL and the new LE are all about speed. The main benefits of CL is its ability to help developers avoid the need to nest ViewGroups, in particular, weighted of multiple LinearLayouts, RelativeLayouts and Views. It will be the darker side of doing the UI designs, The reason to avoid nesting is because the rendering time can grow exponentially with each level of nesting. If the layout time grows too large, your app will start dropping frames; resulting in choppy transitions.  Hence this CL breaks those barriers and provides the concrete floor to design the extensive and rich user interfaces

Secondly, CL is being built from the ground up alongside the new LE. This means the Google Tools developers have taken the time to ensure that layout development with CL and LE is as intuitive and efficient as possible.