Posts

Showing posts from 2018

Faster Data Binding in Android

Image
Faster Image Loading With DataBinding Using RecyclerView in Android.   This post describes the usage of data binding in Android applications. Data binding allows to synchronize your user interface with your application model and logic. - What is Data Binding ? Android Data Binding creates a link between UI layer and the underlying data model that holds the information to display. In normal Android app, it is necessary to find the view and update the content. Every time data changes the User Interface widget (For example:TextView, ImageView used in below example.) bound to it is needs to be update. It eliminates the need for these method calls “findViewById” and “setText.” - Getting Ready from Gradle Configuration Set Up To configure your app to use data binding, add the dataBinding element to your build.gradle file in the app module. android { .... dataBinding { enabled = true } }   - Creating Project   Here I have created a

The Android Network connection Operations

Image
In this Networking tutorial, you will create a simple app which connects to the GitHub API to retrieve and display JSON responce. Here, we will learn about the following: How to check your network connection status. How to perform network operations. How to use open source libraries to perform network operations.   Required Permissions. Open AndroidManifest.xml , and add the following permissions just before the < application tag: < uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" /> < uses-permission android:name = "android.permission.INTERNET" />     Checking the Network Connection. Open MainActivity.java , and add the following method to the class: private boolean isNetworkConnected() { ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context. CONNECTIVITY_SERVICE ); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); return networkInfo != null &a