0

I have an app with the SQlite DB inside and MySQL DB on the server.


SQLite:

Table 1: some columns

Table 2: some columns

MySQL:

The same tables and columns.


I want to ask you: Is it possible and is it the proper way for creating such functionality, like:

User starts the app and there is two buttons <=> activities (Activity 1 & Activity 2)

Activity 1: ListView with data from Table 1

Activity 2: ListView with data from Table 2

For example, user chooses Activity 1. The application proposes to user to update the data. If he/she agrees, the app makes connection with the server and updates SQlite DB Table 1 with data from MySQL DB Table 1.

The same is for Activity 2, but now, the data will be downloaded from Table 2.

Thanks in advance.

1 Answer 1

1

What you describe is perfectly fine, I suggest creating a content provider to wrap your sqlite db. That way you can take advantage of a lot of framework functions to get your data.

You will have to probably implment CursorAdapter to populate data inside a listView.

Check out this link to know more about COntentProviders and Sqlite http://www.vogella.com/articles/AndroidSQLite/article.html

Check out this link to know more about cursoradapters

http://blog.cluepusher.dk/2009/11/16/creating-a-custom-cursoradapter-for-android/

Check out this Google I/O to check out the architecture you could implement on your app

http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! it's clear. Maybe I didn't describe my question propelry, but the main purpose is how to update exactly one table per one request to the sever. The app requests data from Table 1 and then updates it's SQLite DB Table 1 with this data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.