Android UI pattern for saving partial record information into the database
I am designing a simple expenses app which keeps track of expenses I do per开发者_StackOverflow中文版 month. The expenses have a name, amount as well as a category. One can add/delete categories at will. I am storing the categories and expenses in a database.
Right now, the way I am exposing the add categories functionality is by keeping an editText and a button called "Add category" on the "Add Expenses" activity.
So, for a user scenario like when the user does not input anything about the expenses, but just adds the category, I want it to be saved in the database.
The category save can be done immediately in the database by using a AsyncTask to call the database helper to insert a value into the table.
In the mean-time I am confused as to should I put a progressDialog so as to tell the user that I am saving something or let him populate information in the other fields.
What exactly is the UI-pattern or commonly followed strategies while saving partial information of the record into the database. Also, should I just navigate to a different activity, if adding the category into the database produces an error?
Also, a side question, should I put the "Add categories" button in a different Activity than the Add Expenses one?
From http://developer.android.com/guide/practices/design/responsiveness.html:
Potentially long running operations such as... database operations... should be done in a child thread (or in the case of databases operations, via an asynchronous request). However, this does not mean that your main thread should block while waiting for the child thread to complete...
As the original situation of this post was described, a progress dialog is probably not necessary. Perhaps there could be some small visual marker on screen next to the record being saved, indicating it's save state (which might be one of "new", "saving", "saved", "problem/error"). In the case of an error while saving, if it's probably important to the user that the record be saved, then I'd definitely make it very obvious to the user that there was a problem, and provide them with steps to remedy the situation.
Also, note that during at least one recent Google I/O 2011 session (for which videos are available at http://www.youtube.com/googledevelopers), the Android user interface engineers, including the guy that authored the official Twitter app, recommended that blocking UI, such as with progress dialogs, be limited, as their overuse can make for a suboptimal user experience, making the app feel unresponsive and slow to use.
精彩评论