To store or retrieve any information stored in a database on a web server, you need to create a simple web service that will transfer requests to the database, and then return the results from the database back to Android in Android format can understand. You can usually send data in POST or REST and then retrieve the data in JSON format.
There is a very good example of how you could achieve this using PHP here . Here you send requests from Android to a PHP script (hosted on the server) using POST, and then the script will return the results in JSON format, which, in turn, can be analyzed by Android to get the desired result.
This is the main method in which sophisticated web services such as twitter, facebook, etc. Most of the interaction is done using REST and JSON.
source share