Recent Posts

Site Creator

Reading and Writing to Database Efficiently in Android

Posted on

Dear friends

Now its time for the Next Tutorial in Series. For anyone want to study Part 1 of tutorial where we developed a notification demo can visit

Reading and Writing to Database Efficiently in Android

Basically its android UIThread that is responsible for presenting that stunning application UX to user. those killer animations are also performed on UIThread. and at last but not the least it is the thread that responds to User’s touches on the screen.

So doing anything on the UIThread that demands greater computing time we generally offload work request to a worker thread.
worker thread does the work on behalf of UIThread and post results back to UIThread if needed.

DB operations can be a time consuming task.

When you run sample application attached at bottom you will see DB operation is very fast. and UI is responding very fast. Its because we are only dealing with single record. But what if you have more than 500 records to be inserted. [ Surely this will gonna take few seconds of time ] .

Thats why as good citizen we do DB Operations in Background using Asynctasks. To know more about Asynctasks you can study my another blog

Lets get down to work



the DB Handler



Pojo Class


Code DBWriterAndReaderSample

if you have question please post your question in google form

Thanks for reading.

Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.