- This tutorial is the continuation of Login JSON Android using Login Activity
- STEP 1: Preparing the online database facilities in localhost.
- STEP 2: Preparing the PHP script to insert a new record.
- STEP 3: Coding of The Android client
STEP 1: Preparing the online database facilities in localhost.
Our Localhost environment is on Xampp as usual.
Importing the database to the online database. Download the full code below and you will find the SQL-dump file. Import the file and it will create a database named training.
STEP 2: PHP script
Preparing the PHP script to insert a new record. We have lots of files, insertrecord.php are the one in use for this tutorial.
STEP 3: Coding of The Android client
As in the screenshot, the layout is in the layout xml file. This activity is created from the Basic Activity. Kindly download the project folder for the complete code.
HttpHandler.java is the helper class to manage the online connection. Copy and paste to the package folder.
The InsertRecord.java is the file to handle the GUI and the AsyncTask (multi-threading) code. We are just providing the segment code where the multi-threading of storing the new record in the online database, kindly download the project folder for the complete code.
You may call this class from onClick button by
The complete SaveNewRecord asynctask
DOWNLOAD THE COMPLETE SOURCE CODE HERE
Need face-to-face lesson?, we also provide Android Studio training, 0129034614
Disclaimer: Intermediate to advanced level. This tutorial works on Android Studio 2.3. Should you have any difficulties, leave your comment in the comment section.
SHARE to your friends...