Android PHP MySQL tutorial.
Android MySQL : Insert From EditText,CheckBox,Spinner - Part 1 [Introduction]
Today we want to explore how to save several data types into MySQL database from our android application.We want to save boolean and strings to mysql database.The components acting as our input views include edittext,spinner and checkbox .We have a fictional spacecraft with a String property name,String property propellant as well as boolean/integer property 'does technology exist';
What we do :
- User types into EditText,Selects from spinner and checks/unchecks the checkbox.
- We fetch this data and make a HTTP POST request to the server.
- Our MySQL database is hosted locally in localhost.
- The request happens in the background thread.
- We are returned a response depending on the success or failure of the operation.
- If successfull we reset our input views.
- We are using Android Networking library by Amit Shekhar.
Common Questions we answer :
- Save Boolean to MySQL database.
- Save Integers or String to MySQL database.
- Map Boolean to Integers.
- Save From Android to MySQL.
- HTTP POST method.
- Background thread Android Networking.
- Save.Insert from spinner,from checkbox,from editext.
- PHP MySQL JSON Android.
- Object Oriented PHP MySQL database.
What You'll do :
- Create a project in android studio.
- Give it a name and choose minimum and target SDKs.
- Add permission for internet connection in your android manifest.
- Add a dependency statement for a networking library we'll use.
- Create a MySQL table and write some PHP code.
- Run your project.
- I tested mine in bluestacks emulator.
- MainActivity class
- Spacecraft class
- MySQLClient class.
Add Permission for Internet
Part 1 - Introduction.
- Part 2 - Java Code
- Part 3 - XML Layouts.
Part 4 - PHP Code