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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:08:30+00:00 2026-06-05T12:08:30+00:00

How to return a list in a column e.g like all emails in column…here

  • 0

How to return a list in a column e.g like all emails in column…here my code

public String reTurn() throws SQLException 
{

    String emails=null;

    Cursor mCursor = db.rawQuery("SELECT EmailNO FROM  Details_Customer " ,null); 
    mCursor.moveToFirst(); 


    if(mCursor.getCount() > 0){ 
        emails= mCursor.getString(mCursor.getColumnIndex(DBAdapter.COLUMN_EMAIL)); 
        //password = mCursor.getString(11);
    }
return emails;
  }

But it only returning one email, I want it to return all the emails in a database

  • 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-05T12:08:32+00:00Added an answer on June 5, 2026 at 12:08 pm

    Try this:

    public List<String> reTurn() throws SQLException 
    {
        List<String> emails = new ArrayList<String>();
        Cursor mCursor = db.rawQuery("SELECT EmailNO FROM  Details_Customer ", null);
    
        int index = mCursor.getColumnIndex(DBAdapter.COLUMN_EMAIL);
        while(mCursor.moveToNext()) {
            emails.add(mCursor.getString(index)); 
            //password = mCursor.getString(11);
        }
        return emails;
    }
    

    Added from comment

    From this:

    email.putExtra(Intent.EXTRA_EMAIL, new String[]{ dbUser.reTurned});
    

    I guess that your are trying to put the array of email addresses into an Intent called email. Here is a better approach:

    public String[] reTurn() throws SQLException 
    {
        Cursor mCursor = db.rawQuery("SELECT EmailNO FROM  Details_Customer ", null);
        String[] emails = new String[mCursor.getCount()];
    
        int i = 0;
        int index = mCursor.getColumnIndex(DBAdapter.COLUMN_EMAIL);
        while(mCursor.moveToNext()) {
            emails[i++] = mCursor.getString(index); 
            //password = mCursor.getString(11);
        }
    
        return emails;
    }
    

    And to put this in an Intent:

    email.putExtra(Intent.EXTRA_EMAIL, dbUser.reTurned());
    

    Lastly, in your new Activity read the email array with:

    String[] emails = getIntent().getStringArrayExtra(Intent.EXTRA_EMAIL);
    

    Hope that helps.

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

Sidebar

Related Questions

I have a situation where i want to return List<> from this function public
I would like to create a function that will return list of type that
This works to return a list of ints: public List<Integer> GetIListImpl() { return new
Is it possible to return a list of all the properties implemented by an
How do I get a list of all column names in a table that
I have a function like this public static string GetNumberOfColumns(string ConnectionString) { StringBuilder sb
I have a class that looks like this: public class Analyst { [Column(Internal_ID)] public
Just wrote a web service and try to return columns of a sharepoint list
Take this method /** * @return List of group IDs the person belongs to
How can I return List<personel> data type from below procedure. If I press F5

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.