开发者

Android - Database vs Business logic for frequent updates

I am developing an application where I use at least 5 Countdown timer with different initial time. I load the initial time together with other information from a Sqlite db and use an Activity to show the user the state of these timers. I need to populate a ListView with timers informations every seconds. Usually the initial time can be 2 or 3 hour long so I developed a Service for the business logic and a CountdownTimer for each timer.

Do you think is a good idea binding the GUI directly with the db or it's better to use some business logic objects as middle-man?

I read in this question that in Android most of the docs show the binding of database and GUI. They开发者_Python百科 answered that this approach is preferable for performance reasons but I think that's not my case.


I finished. At last I decided to bind the GUI to my business logic objects and building this objects from the database only before the timer is started. Every timer tick I change only the business logic objects in memory. I realized this way I need to update my db fewer times, only when the timer is stuck. I think this way my application is faster.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜