My Android app is working with a SQLite database that is stored locally on the device. I now want to switch over to a MySQL database that is running on a web-server.
My question is: so far, working with the local database, all data processing of the query results (some ListView visualisation, some calculation stuff) relies on the cursor object given back by the CursorLoader. If I switch to the web database, how do I have to handle the JSON data received from the API in order to get a cursor? Do I simply have to JSON-decode it and then use it as a cursor object? Is this possible? If not, then I would have to restructure my entire code in order to process the JSON-data instead of a cursor...If possible I would like to avoid that. So far, the database module of the app is based on an Async CursorLoader that gives a cursor as a result. I use the SQLiteOpenHelper for the database connection and queries.
Now I have set up a MySQL database on a web server, it will be accessed via an API (PHP). The PHP script does all the MySQL-queries via PDO, then JSON-encodes the results and echoes them back to the client.
Aucun commentaire:
Enregistrer un commentaire