EGHDK
EGHDK

Reputation: 18120

Intro to Android SQLite

I need to learn how to use databases for my application, so I have decided to go with vogella's tutorial as most of his other tutorials are very helpful. I just have a few questions to make sure my application will be compatible across devices.

He mentions that his tutorial will use the Async loader class

This tutorial describes how to use the SQLite database in Android applications. It also demonstrates how to use existing ContentProvider and how to define new ones. It also demonstrates the usage of the Loader framework which allows to load data asynchronously.

http://developer.android.com/reference/android/content/AsyncTaskLoader.html shows that the minimum API level is 11?

How should I go about learning SQLite in Android? Should I use this tutorial? I want to make sure I'm using the best standards, yet getting compatibility as far back as possible (At least API level 7)

Upvotes: 2

Views: 899

Answers (2)

Tyler Treat
Tyler Treat

Reputation: 14988

It's generally best practice to make SQLite calls asynchronously. You could use the Android support library which has AsyncTaskLoader, but I usually just extend AsyncTask, which was introduced in API level 3.

Upvotes: 2

dagalpin
dagalpin

Reputation: 1307

The AsyncTaskLoader is supported using the Android support library

http://developer.android.com/tools/extras/support-library.html

back to V4. CursorLoader (subclass of AsyncTaskLoader) is the preferred way for handling SQLite transactions while maintaining smooth UI flow on Android. Note that CursorLoader does require the use of a ContentProvider, so it's worth looking at ContentProviders as well.

Upvotes: 0

Related Questions