Skip to main content

Posts

Android AsyncTask Example in Kotlin for background processing of task

The AsyncTask help us to perform some operation in background and update the results or status of the work to main thread. Here in this tutorial of  " Android AsyncTask Example in Kotlin"   we will learn about how to implement the AsyncTask using Kotlin code in Android for performing the background operation. Prerequisite We required AndroidStudio 3.0 or later At the time of wiring this tutorial we have Kotlin Pulgin version 1.2.10.  You can check out the " Getting started with Android Development in Kotlin " if you have not setup the plugin yet Why and where to use the AsyncTask? Android system will perform the task on main thread in sequential order one by one. So what happen in the case if we have to run some process for long time, like downloading the file from internet or backend, or any other task which may took long time? It will hold the main thread and user may fill bad user experience. Android enforce the application to respond within 5 seconds. If a...

How to Read and Write JSON data in Kotlin with GSON

Kotlin is now official language for Android development and it is well supported in Android Studio. So here in this tutorial, we are going to learn about how to read and write JSON data in Kotlin using GSON. If you would like to learn the java version of this tutorial check out the last tutorial " How to Read and Write JSON data using GSON ". Introduction In this tutorial, we will write two methods. In the first method, we will create a JSON file and in second method we will read the file and print in a text box.  If you like to know more about the basic entity of JSON you can check out Basic JSON entity here . What is JSON? JSON stands for J ava S cript O bject N otation JSON is a lightweight data-interchange format It is "self-describing" and easy to understand JSON is language independent and can we used in any language JSON Syntax Rules Data is in name/value pairs Data is separated by commas Curly braces hold objects Square brackets hold ...

How to Implement google SignIn API Android Example

Implementing SignIn method is one of the very important requirement for any standard application. You may already implemented the SignIn method to your app or may be not done.  But, In both case it is important to implement  the social SignIn and Sign-up method to your app. Why you should integrate the social SignIn and SignUp method? We have several benefit if we implement the Social SignIn method. You may don't have any backed to handle the user authorization to validate the genuine user May be you have backed but still its very useful to integrate the social SignIn and Sign-up, because Social login is very fast Social login is one click Sign-up option, which make user on-boarding very easily Many users not prefer to provide lots of info in your long user registration form Prerequisite for this tutorial of " How to implement google sign in Android Example " You need a working google account Latest version of android studio A project configured to co...

How to Read and Write JSON data using GSON

JSON stand for JavaScript Object Notation . In today's development world online application design is not possible without the skills of the JSON. Every application need to read and write the data into JSON format. So, here in this tutorial we are going to learn about " How to Read and Write JSON data using GSON" Here JSON means we need to add com.google.code.gson:gson:2.8.0 as dependency in our application build.gradle file. So before starting this tutorial you should create a Simple Project with name of "JSON Tutorial" or any other name you per your preference. For more advanced use of JSON, read below tutorial:- WP Android App using REST and volley WP Android App using REST and volley part2 JSON Basic Element A JSON object contain many part. Here is the details about how data are stored into the JSON file. JSON Array([) In a JSON file , a square bracket ([) represents a JSON array, we can retrieve the JSON array using the below method. JSONArray jsona...

WP Android App using REST and volley part2

In last part of WP Android App using REST and volley tutorial we have learned to set up the basic UI of our WP app. In this part we will learn how to implement the below two features for our WP app. Retrieve the sort description of the post and show in WP app Show the featured Image in WP app So first we will start by retrieving the short description of the post and show that description in our WP app. In last tutorial we only show the title of the post, but we know showing only short title will not describe the post very well, so we should show some short description about the post. For this we don't need to do much work just need to retrieve the excerpt tag from the JSON Object that we have already fetched during retrieving the list of all post for our WP android App. Below is the link of the series or Article of WP android App WP Android App using REST and Vollery Part1 WP Android App using REST and Vollery Part2 LiveData and ViewModel for WP Android App usi...

WP Android App using REST and volley

In this tutorial, we are going to create a sample app for WordPress using the rest API for Android. For successful implementation of the rest API for WordPress we need to it in two parts. In the first part, we will learn some basic configuration on the server side and configure the Android project in android using the Android Studio. WP Android App using REST and volley part1 WP Android App using REST and volley part2 LiveData and ViewModel for WP Android App using REST and volley part3 Requirement to create the Android App for WordPress WordPress API is included in core release of the WordPress version 4.7 and above. For older version, you need to install the WordPress plugin API Android Studio 2.X.X or 3.X.X If you are using the WordPress version 4.7 and above you do not require any special configuration for this, you can just test your configuration by sending the sample request to the  http://yoursite/wp-json/  . You will get the output into the JSON format....

Implementation of SwipeRefreshLayout in RecyclerView

SwipeRefreshLayout is the layout can be used when user want to update the content of the view using swipe to refresh gesture. For example, ListView, GridView, RecyclerView  or any other place where we need to update the content of the view using vertical swipe gesture. Here in the tutorial we will learn how to implement  the SwipeRefreshLayout in RecyclerView. You May Like:- How to Create Video Gallery App Using Recyclerview How to Read and Write JSON data using GSON Create Animated Video thumbnail in android Create Swipe Refresh Layout Demo Project For demonstration of SwipeRefreshLayout we will create a project in which we required following class and XML layout files. MainActivity.java RecyclerViewAdapter.java activity_main.xml item.xml When you will create the project you will get the MainActivity.java and activity_main.xml by default. After that we need to update both as per our requirement to implement the Swipe Refresh Layout in RecyclerView. Add RecycylerView and Swipe...