Langsung ke konten utama

Postingan

Menampilkan postingan dengan label Rest API

How to Perform Rest API using Retrofit in Android (Part-2)

In this post, I will show you How to use Retrofit in Android. Retrofit is a new born baby of web services such as AsyncTask, JSONParsing and Volley.In Previous Part , I showed the PHP Scripts to perform basic CRUD operations. In this part, Contains the informations about how to perform Retrofit Operations in Android. Project Structure: Create New Project in Android Studio with blank activity as in the following. We need Retrofit Library for working with that. For Android Studio you just need to paste below line of code under dependency of build.gradle file. compile 'com.squareup.retrofit:retrofit:1.9.0' For eclipse users download jar file from below link and add to you project. Download jar AndroidManifest.xml Don't forget to add the following permission in your manifest file <uses-permission android:name="android.permission.INTERNET"/> AppConfig.class Create AppConfig.class and replace it with the following code.It is used as helper class for web services...

How to Perform Rest API using Retrofit in Android (Part-1)

In this post, I will show you How to use Retrofit in Android. Retrofit is a new born baby of web services such as AsyncTask, JSONParsing and Volley. This post is Split into Two Parts. First Part Contains Architecture of Retrofit and How to create MySQL DB and PHP Scripts for Basic Operations. Second Part Contains how to perform Retrofit Operations in Android. Architecture of Retrofit Web Service We need 3 Things for Complete Retrofit Architecture. RestAdapter An Interface with all networking methods and parameters. Getter Setter Class to save data coming from server. Project Structure: Create MySQL DataBase and PHP Scripts. Following image shows my database structure. PHP Scripts: I created db_config.php which contains the script to connect DB. <?php /** * Database config variables */ define("DB_HOST", "localhost"); define("DB_USER", "root"); define("DB_PASSWORD", ""); define("DB_DATABASE", "retrofit_exampl...