Jump to content
Android Forum - A Community For Android Users and Enthusiasts

Android SQLite database question.


Recommended Posts

So I'm making an app that displays products on a ListView using a SimpleAdapter and basically what I have done is create a database object and I can send a product object to have it saved to the database or I return either individual products or an ArrayList of products.


In my ListView activity I create an ArrayList of product objects and call the ArrayList return method. Then bind everything to the ListView. When the user selects an item on the ListView it goes into a details page that displays information about the product selected.


I was thinking of sending an Intent with the rowID of the product in the database and then have the details screen pull the product from my DataBase object.


I was wondering:

Would keeping the database open() for the ItemSelected page increase efficency?

I could call,

Product myProduct = new Product(MainActivity.DataBase.getProduct(SQLRowID))?


Or would I just have to create a new DataBase object in the new activity and open() it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...