Please check this tutorial here and set up a database with this structure
Tuesday, July 14, 2015
Connect Android To Java REST Web Services And MySQL.
Sometimes you want to make a mobile application that sends and receives data from the database. While JDBC library can help you achieve that, its a good practice that you create a web service to act as an intermediary. Using JDBC creates vulnerability because you will have to hard code you r database login credentials in your application code. An attacker would simply have to reverse engineer your code and read all of the details. Using web services does not only increase security but, it prevents redundancy. All queries and transactions are done at the web services layer. With this kind of a set up, different platforms can utilize the web service without rewriting any code. The general architecture looks like this.