• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[newbie] - Doubt about design

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!


Thanks

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic