Android database access (simple and performant)
<p>I'm currently playing around with the android API. Currently I'm doing a bit of GUI-database binding and I'm starting to get a bit annoyed. </p>

<p>I have a simple <code>ListActivity</code> with a custom layout for the list items. Now I want to bind the underlying <code>ListView</code> to a table in the database. Whenever I make changes to the database I want to be able to notify the ListView to refresh itself and update the GUI. At first, the problem look straightforward: just add a <code>SimpleCursorAdapter</code>, pass it a cursor for fetching the data, bind columns to layout ids and your down. Whenever you want to do a refresh simply call <code>notifyDataSetChanged()</code> on the ListView and you are done, right? No!</p>

<p>Turns out, this way the database will be queried in the UI thread which is obviously a bad thing as it will degrade performance and could lead to "application not responding" errors.</p>

<p>Currently, it looks like the only way is to use Loaders and ContentProviders. This may be the most abstract and cleanest way to handle data access but it also adds a huge amount of code (especially in the ContentProvider itself where you have to do a lot of ugly if-else switch-case handling for "parsing" the requests). </p>

<p>So my question is: what is the state of the art (and backwards compatible to API level &lt;11) way to connect a database table to a ListView (or any other UI components)? Do I really have to use a ContentProvider?</p>

<p>And why is this so complicated? I.e.: scanning for a bluetooth devices can be implemented in abaout 20 lines of code but for (from my perspective) much more common thing like data-ui-connection you have to implemented at least two classes which 100+ loc each. This is madness!</p>
