This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Android and the fly likes [newbie] - Doubt about design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Mobile » Android
Bookmark "[newbie] - Doubt about design" Watch "[newbie] - Doubt about design" New topic

[newbie] - Doubt about design

Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
I have a doubt about how to design my first android application.

Basically, I have three different activities using a ListView with checkboxes, fecthing rows from a DB (so the adapters extend CursorAdapter).

I am using an application in order to store the user’s choiches (a couple of array), and some methods like addElement(), removeElement()...

I have a DBHelper with some methods like giveNameByID(), giveColorByID().....

Sometimes, mainly in the adapters, I need to interact with the Application AND with the DBHelper, so I declare as fields of the Adapter a DBHelper and an Application.

My question is:

Is it better to declare as field the DBHelper into the Application and make that the activitis/adpaters use only the Application or I can use Application an DBHelper everywhere?

I am asking this because sometimes I get some serious warning about non closing the DB!
In every activity I filled the methods OnPause(), OnDestroy() with a DBHelper.close(), but It seems it is not enough!


I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: [newbie] - Doubt about design
jQuery in Action, 3rd edition