Unable to populate Spinner with data from the remote server database

I am trying to figure out how to populate a Spinner (ultimately the whole spinner form) with data retrieved from a remote MySQL database. I read hundreds of examples and tried to reproduce all of them, but to no avail.

I worked with this example from http://www.mickyjay.co.uk/blog/?p=679 I could never get it to work, but it seems to be the most promising of the party.

QUESTIONS:

1) Do I need to use the JDBC bridge to connect to the server? (I read that Android does not come with a library for connecting to a remote server).

2) I'm not looking for someone to do this for me. If anyone has links to resources that are CLEAR and well documented. I would be very grateful.

+4
source share
1 answer

Since you have a MySql database, it is useful to use PHP to connect to the database and send the result back to android using a JSON response. Android and PHP support JSON. Then you can read JSON and process the data as you want on the Android side. You are using an HTTP request to run a php script. Take a look at this tutorail, which shows how to use android, PHP and MySql together http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/

+1
source

Source: https://habr.com/ru/post/1439034/


All Articles