Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7904123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:55:14+00:00 2026-06-03T09:55:14+00:00

I have data coming out of a SQLite database, normally, I grab an item

  • 0

I have data coming out of a SQLite database, normally, I grab an item from the DB and put it into my custom data Class “Invoice” which holds all of the particulars of an invoice. Within Invoice I have business logic to return things such as the Invoice’s balance (Sales Invoice will return the Invoice’s credit, Expense Invoice will return the Invoice’s debit) as well as other accounting specific quirks.

This being said, when I execute my SQL query and grab a cursor, chucking the cursor into a SimpleCursorAdapter and having my way with it doesn’t work as the business logic embedded into my Invoice class is bypassed. I’m thinking I am going to have to convert each cursor result into an Invoice object and then somehow list these objects in a ListView. Is this the most optimal way? Or, should I break convention and code the logic into my controller (the Class grabbing the cursor in the first place)?

I’d like to keep things as understandable as possible. This being said, I’d rather have a “purist” approach to this problem (e.g. keeping this object oriented within the MVC paradigm as much as possible) instead of hacking some logic together in the controller to do the logic.

What do you think? What would you do? One one hand using the “purist” approach definitely will take more processing power as it is less direct, however, would the maintainability and clarity of the code make up for this?

I appreciate your viewpoints!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:55:16+00:00Added an answer on June 3, 2026 at 9:55 am

    …chucking the cursor into a SimpleCursorAdapter and having my way
    with it doesn’t work as the business logic embedded into my Invoice
    class is bypassed.

    If you use the plain SimpleCursorAdapter. Instead, you could extend SimpleCursorAdapter and implement whatever logic you want in the bindView() method, but I guess you already know this(?!). Another option is to use the plain SimpleCursorAdapter and use a SimpleCursorAdapter.ViewBinder to bind the data where you need to do extra stuff that the SimpleCursorAdapter can’t handle.

    Is this the most optimal way?

    Probably not.

    What do you think? What would you do?

    If you build the Invoice class(along with the extra stuff) only to display it to the user(in a ListView) then I would drop building the Invoice class and implement whatever logic directly in the Adapter, ViewBinder etc(this probably isn’t the “purist” approach, but I think this is the most efficient way especially if the cursor with data will have like several hundreds rows).

    If you would use the Invoce class in other parts of your code also then I will probably pull the data from the cursor first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data from database coming out in a loop. Each of these
I have data coming from the database in the form of a DataSet .
I have data in this format coming from a database... BUS 101S Business and
I have a chunk of xml data that's coming out of a database that
I have data coming in from datastage that is being put in our SQL
I have data coming into my Model, how do I setup to insert the
I have a stream of data coming in over the serial line from an
I have a table in C#, the data is coming from an Excel file.
I have some data coming out of an DB that I can't readily change
I have some data coming from other tiers and it represents an EF object.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.