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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:33:50+00:00 2026-06-07T19:33:50+00:00

I have to retreive a string from database using their id.I done thet retreival,But

  • 0

I have to retreive a string from database using their id.I done thet retreival,But it is returning as some object format not as a string.Please help me..

My retreival place:

db.open();
     for(int i=1;i<=5;i++)
     {       
     if(i==1)
         group1=db.getspintitle(1);
     if(i==2)
         group1=db.getspintitle(2);
     if(i==3)
         group1=db.getspintitle(3);
     if(i==4)
         group1=db.getspintitle(4);
     if(i==5)
         group1=db.getspintitle(5);     
     }

db.getspintitle() method:

public String getspintitle(int rowId)throws SQLException
{

    String sumtotal="";
    Cursor cursor1 = db.rawQuery(
             "SELECT spin from spinner WHERE _id='rowId'", null);  
     sumtotal=cursor1.toString();   
     cursor1.close();       
     return sumtotal;   
}
  • 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-07T19:33:51+00:00Added an answer on June 7, 2026 at 7:33 pm

    For your information, The below returns you the Cursor, not the simple String.

    Cursor cursor1 = db.rawQuery("SELECT spin from spinner WHERE _id='rowId'", null); 
    

    To retrieve value from the cursor, you have to iterate through the cursor.

    Now, here in your case, you can do as below:

     Cursor cursor1 = db.rawQuery("SELECT spin from spinner WHERE _id='rowId'", null);  
    
         if (cursor != null && cursor.getCount() > 0) {
             cursor.moveToNext();
             sumtotal= cursor.getString(0);
             cursor.close();
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve some rows from the database using simple SELECT statement
I'm using Hibernate to retrieve some data from a database. The result set returned
I have been trying to retrieve particular fields from my database using NHinernate. The
I have created a database and i want to retrieve some data from the
Let's say I have a string that I retrieve from a DB like: Lorem
I have a coded string that I'd like to retrieve a value from. I
I have a json string saved in my db. When i retrieve it from
I have the following that I retreive the title of each url from an
I'm using a SQLite database to store information on players and their teams using
I am using datatable to retrieve 1000 records from mysql database. I want to

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.