Android PHP MySQL - Images and Text - Select then Fill ListView Part 1\[Introduction\]

November 2, 2017 Oclemy Android MySQL, Android HttpURLConnection, Android ListView 2 minutes, 3 seconds

Android MySQL images text listview Applications are many that show lists of data in google play.Most of the time these images aren't stored locally.That would be a disaster in terms of space storage for most applications.These images usually have to be in some ways dynamic.Image manipulations when done locally can be quite resource intensive,hence the resizing and manipulations can be done in the server side.Anyway today we want to see how to retrieve images from a  MySQL database and show them in our ListView.We only retrieve the image urls from the database and render the images using Picasso.This ensures we can lazily load the images and can even resize them without any considerable performance penalty.We show text alongside the images.  

Quick Menu :

  1. Introduction
  2. Classes - Java Code.
  3. Layouts - XML Code.
  4. Server Side - PHP Code.


What we do :

  • Fetch images urls and text from MySQL database.
  • Of course via PHP.
  • We make a HTTP GET Request hence receiving a blob of json data.
  • This data,the json array,we parse it using JSONArray and JSONObject classes in our java android.
  • We render the images using Picasso ImageLoader library.
  • The ListView consists of images and text.
  • We are using AsyncTask to perform this GET request.
  • This ensures our Main Thread remains responsive.
  • To show user progress we use ProgressDialog.
  • Both parsing and downloading data,we abstract them in separate classes.
  • We also do both in background thread.

Common Questions we answer :

  • Images and Text MySQL database.
  • Image URLs MySQL database.
  • Android MySQL Select data.
  • Fill ListView From MySQL.
  • Custom ListView with Images and Text.
  • AsyncTask threading.
  • PHP MySQL android select data.
  • Download JSON AsyncTask.
  • parse JSON AsyncTask.
  • Show progress asynctask.
  • Making HTTP GET Request.
  • Picasso Imageloader to load images to ListView.

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 Picasso library we'll use.
  • Create a MySQL table and write some PHP code.
  • Run your project.
  • I tested mine in bluestacks emulator.

Overview :


  1. MainActivity class
  2. Spacecraft class
  3. Connector class.
  4. Downloader class.
  5. DataParser class.
  6. CustomAdapter class


  1. ActivityMain.xml
  2. ContentMain.xml
  3. Model.xml


  1. Add Permission for Internet

  Project Structure

Project Structure Image

Expected results

Android MySQL ListView]( Android MySQL ListView[/caption]


Quick Menu :

  1. Introduction
  2. Classes - Java Code.
  3. Layouts - XML Code.
  4. Server Side - PHP Code.