Android JSON Parsing Using okHttp Example with Custom View (ImageView + TextView)

Android JSON Parsing Using okHttp Example with Custom View (ImageView + TextView)

Hello Androiders, Today I will show you demo about “How to Parse JSON using okHttp and Bind data with Custom View (ImageView + TextView) (Loading Image using Picasso)”.

JSON Parsing with OKHTTP Example

JSON Parsing with OKHTTP Example

In Last Post We have seen Android JSON Parsing Using okHttp Example with New Material Design Library in which you have learn How to Parse JSON using okHttp.

I hope you know how to Create Project in Android Studio and add gradle dependency:

In this Project we required following Dependency in your build.gradle:

Don’t forget to take permission of Internet Connection. 🙂 🙂

Our Project Structure will be like:

Android JSON Parsing Using okHttp Example with Custom View (ImageView + TextView)

Json Parsing with Okhttp Example – Structure

 

To Check Internet InternetConnection.java:

 

Now First of all we will get JSON from http://pratikbutani.x10.mx/json_data.json which provides following type of data.

JSON DATA:

 

Constant Keys are defined in Keys.java:

Now we will make Model for this Data so we can set or get the values of particular fields.

MyDataModel.java

Now Its time to create XML file for layout which will display data like NAME, IMAGE, EMAIL.

layout_row_view.xml

Its fine we have created Layout for Particular row of ListView. Now We have to create Custom Adapter to bind Data in that row.

I found best tool Android Layout Finder to create that type of Adapters Quickly.

MyArrayAdapter.java

JSONParser.java (Copy and Paste this class in your Package): (Same as Previous Post)

 

activity_main.xml (Same as Previous Post) :

MainActivity.java: (Same as Previous Post, Just Created Custom Adapter so Created Class type ArrayAdapter and ArrayList.)

 

Output:

Android JSON Parsing Using okHttp Example with Custom View (ImageView + TextView)

Json Parsing with Okhttp Example

YOU CAN VISIT FOR WHOLE CODE: 

JSONParsingUsingOkHTTP on GitHub

#KeepSharing #KeepLearning #KeepReviewing 🙂

Thank you.

Page Views (9353)

13415 Total Views 1 Views Today
Support with Your Share:

About pratikbutani

Enthusiastic Android Application Developer, Speaker at Google Developer Group - Rajkot, All time Learner of new things, Googler, Eager to Help IT Peoples. Master of all, Jack of ONE.

Comment Your Suggestion or Appreciation:

Loading Facebook Comments ...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.