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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:49:47+00:00 2026-05-26T17:49:47+00:00

After querying the data I wanted, I now have a cursor holding all the

  • 0

After querying the data I wanted, I now have a cursor holding all the data, presented to the user in a Listview.

When a user clicks an item in order to edit it, I move the cursor to the right position cursor.moveToPosition(pos), from which I can get all the item’s data I need: ID, Title, Folder or not, Parent folder.

Now that I have the Parent folder ID, how can I use it in order to get the title of the item’s folder so I can show the user in what folder the item is currently in?
I can’t use move to position because I don’t know the parent position, only its ID.

Here’s an example of the db.

FOLDER column -> 0 = not a folder (false), 1 = a folder (true)

PARENT column -> holds the ID of its folder

ID  TITLE     FOLDER   PARENT
1   folder1      1        0
2   item1        0        1
3   item2        0        1
4   folder2      1        1
5   item1        0        4
6   item2        0        4
7   folder3      1        4
8   item1        0        7
9   item2        0        7

Example:
User edits item3. I move the cursor to position 2 (starting from 0). I get item3 parent, which is ID=1. How can I get the TITLE of ID=1.

Hope it’s clear enough 🙂
Thank you!

  • 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-05-26T17:49:48+00:00Added an answer on May 26, 2026 at 5:49 pm

    You can either loop through the cursor again checking each id to see if it is 1 and then get the title.

    cur.moveToFirst();
    while (cur.isAfterLast() == false) {
      if (cur.getInt(cur.columnIndex("ID") == 1) {
          String title = cur.getString(cur.columnIndex("TITLE"));
      }       
      cur.moveToNext();
    }
    

    Or you can issue a new query where id = 1.

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

Sidebar

Related Questions

I have a Java Webserivce which querying a DB to return data to users.
After lots of attempts and search I have never found a satisfactory way to
I am querying data from CRM 2011 using FetchXML to build a report in
I have a class MyCLController with a property dataSource that is data source delegate
In my MVC application I have a problem with passing data from view to
I have a web application written in PHP. It uses MySQL for data storage.
I want to generate a whole lot of SQL*Plus scripts by querying the data
We have an WCF application which uses NHibernate to query data from the database.
all I want to display last 5 entered data for specific id. My sql
I am using highcharts in my yii based application. after querying the database I

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.