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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:34:52+00:00 2026-05-26T02:34:52+00:00

i have a method that return a ArrayList from a sqlite query, only a

  • 0

i have a method that return a ArrayList from a sqlite query, only a 1 row, this array must have 3 strings; name,description and photo(This is a patch string). But i don’t know how i can separate the data.

public ArrayList<Object> getLugarPorNombre(String nombre)
{

    ArrayList<Object> rowArray = new ArrayList<Object>();
    Cursor cursor;

    try
    {

        cursor = db.query
        (
                TABLE_NAME,
                new String[] { TABLE_ROW_ID, CNOMBRE, CDESC, CFOTO },
                CNOMBRE + "=" + nombre,
                null, null, null, null, null
        );

        //movemos el puntero a la primera posicion
        cursor.moveToFirst();

        // Si hay datos los añado al array que sera devuelto
        if (!cursor.isAfterLast())
        {
            do
            {
                rowArray.add(cursor.getLong(0));
                rowArray.add(cursor.getString(1));
                rowArray.add(cursor.getString(2));
                rowArray.add(cursor.getString(3));
            }
            while (cursor.moveToNext());
        }

        cursor.close();
    }
    catch (SQLException e) 
    {
        Log.e("Error obteniendo datos de lugar", e.toString());
        e.printStackTrace();
    }

    return rowArray;
}

and

   ayudabbdd = new DataBaseHelper(this);
    ArrayList<Object> datosLugar = ayudabbdd.getLugarPorNombre(nombreClick);

Can i get the name from array list or description in a separate string?

  • 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-26T02:34:53+00:00Added an answer on May 26, 2026 at 2:34 am

    Sure you can.But your ArrayList has 4 items not 3 as you mentioned in your question above.just you have to play with ArrayList like this

    String name=datosLugar.get(1).toString();
    String description=datosLugar.get(2).toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method fetchObjects(String) that is expected to return an array of Contract
Do Java collections have a built-in method to return multiple items from that collection?
I have a method that returns an IEnumerable<KeyValuePair<string, ArrayList>> , but some of the
I have a method that can return either a single object or a collection
I have a C# class method that return a xml document not file. How
I am using java language,I have a method that is supposed to return an
I have an action method that depending on some conditions needs to return a
In Python compiled regex patterns have a findall method that does the following: Return
I have a script with a factory method that I would like to return
So I have this array list that is populated using a csv file. Once

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.