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

  • Home
  • SEARCH
  • 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 7985789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:39:32+00:00 2026-06-04T11:39:32+00:00

I am trying to create a public string that will be used in other

  • 0

I am trying to create a public string that will be used in other parts of my app. I have tried to review the use of cursors but I couldn’t find out how it would return what I wanted. I just need this to be a public method to return the value of the column email where the rowId = 1.

How far off-base am I with this and please give me some pointers? This method is inside my DatabaseHandler class

public String getUserName(String email) {

    SQLiteDatabase db = this.getReadableDatabase();
    String memail = 
            db.rawQuery("SELECT _email FROM login WHERE key_id = 1;", null);
    return memail;
}
  • 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-04T11:39:33+00:00Added an answer on June 4, 2026 at 11:39 am

    Use of cursor:

    String q = "SELECT * FROM login where(key_id = 1)";
    Cursor c = db.rawQuery(q, null); //  db is a object of SQLiteDatabase type  
    

    Then retrieve value column email like:

                  if(c.getCount() == 0)
                  {                   
                     //No entry found
                  }
                  else  {
                      c.moveToFirst();
                      do {
                          String mail = c.getString(c.getColumnIndex("email")); 
                            } while (c.moveToNext());               
                c.close();
    

    Use it in your method and return the value of String mail 🙂

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

Sidebar

Related Questions

I am trying to create an app that will send some data to a
I am trying to create dynamic predicate so that it can be used against
I am trying to create a SQL statement that will allow me to remove
I am trying to create a query that will return a List of Person
I am trying to create a service that will handle file I/O in the
I'm trying to create a view that will need 2 dropdown lists with MVC
As an exercise, I'm trying to create a input stream manipulator that will suck
I am trying to create a RenderAction method on the Master page that will
I'm trying to create a public gist via javascript. I'm not using any authentication
I'm trying to create a 2 dimensional array of Node objects as follows public

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.