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 8429249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:16:59+00:00 2026-06-10T05:16:59+00:00

I have a Cursor which takes some categories from my DB, but I need

  • 0

I have a Cursor which takes some categories from my DB, but I need to manually add a category which is not in the DB, so they can all be rendered in a ListViewActivity.
The way I get the categories is the following:

Cursor categories = myDbHelper.getCategoriesCursor(
                    categorySelected, Tools.getLanguage());
            startManagingCursor(categories);
            CategoriesCursorAdapter categoriesAdapter = new CategoriesCursorAdapter(
                    getApplicationContext(), categories);
            setListAdapter(categoriesAdapter);

I thought of creating a new ArrayList<String> with the fields I want and passing it to the Adapter but still, I can’t grab those values and add them to the categories list.

How could I do this?

Thanks a lot in advance

EDIT: This is the method to get the categories in ‘my DatabaseHelper’

public Cursor getCategoriesCursor(int parentId, int language) {
        try {
        String sql = "";
        if (parentId == 0) {
            sql = "SELECT 0 as '_id', 'Agenda' as 'name_category', 0 as 'sort' UNION ALL SELECT categories._id, name_categories.name_category, categories.sort "
                    + "FROM categories JOIN name_categories ON categories._id = name_categories.category_id "
                    + "WHERE categories.parent_id = " + parentId
                    + " AND name_categories.language_id = " + language + " ORDER BY sort";
        } else {
            sql = "SELECT categories._id, name_categories.name_category "
                    + "FROM categories JOIN name_categories ON categories._id = name_categories.category_id "
                    + "WHERE categories.parent_id = "
                    + parentId
                    + " AND name_categories.language_id = " + language + " ORDER BY sort";
        }
        Log.d("XS2TheWorld", sql);
        return myDataBase.rawQuery(sql, null);
        } catch (Exception e) {
            try {
                copyDataBase();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            return getCategoriesCursor(parentId, language);
        }
    }
  • 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-10T05:17:00+00:00Added an answer on June 10, 2026 at 5:17 am

    Easier: I just modified my SQL query and it worked

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

Sidebar

Related Questions

I am creating a Control Library project. I have some Cursor files which i
I have a stored procedure which returns a ref cursor as follows: CREATE OR
I have a stored procedure in oracle which is using cursor.Its fetching the data
If I have a function which returns a reference cursor for a query, how
So I have my MainDisplayActivity which implements both Activity and LoaderManager.LoaderCallbacks<Cursor> . Here I
I have the cursor with the query statement as follows: cursor.execute(select rowid from components
I have to improve some code where an Oracle stored procedure is called from
My application have to load some points from internal sqlite database of android, and
I have the following Django Model which retrieves 3 records from a database. The
maybe some one can help me with this... I have a custom search button

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.