
All our classes are standard Java/Android classes. We don’t need any special dependency for this project.

Step 2 Add the following code to res/layout/activitymain.xml. Step 1 Create a new project in Android Studio, go to File New Project and fill all required details to create a new project. First create an empty project in android studio. This example demonstrates how do I get spinner value in android.Our data will be sent over the HTTP as JSON string.īoth Java and PHP understand JSON so that’s why we use it. We’ll also use JSONObject and JSONArray to parse or process JSON. AsyncTask is an abstract threading class that allows us to make these types of apps without renderring our UIs unresponsive. To work achieve this we’ll also need an AsyncTask class. It’s an abstract class that derives from URLConnection. HttpURLConnection is the standard java networking class. Most notably is the HttpURLConnection on Java. Android is written in Java while PHP is a popular server side language we can comfortable use.īoth languages define us simple APIs we can use for this task. Then we can connect the two over the HTTP protocol. To connect them we need the help of a server side programming language. You cannot directly connect Android and MySQL database as mysql runs on servers and desktops while android runs on mobile devices.

This tutorial explores how to connect both via the HTTP. MySQL is a fast open source relational database management system.Īndroid on the other hand is a software platform for a variety of devices most notable mobile. How to fetch data from mysql database and render them in a Spinner. Android PHP MySQL – Spinner – Retrieve data and showĪndroid MySQL : Spinner – Retrieve data and show
