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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:22:50+00:00 2026-05-26T04:22:50+00:00

What I’ve done I have a Gridview which is filled over my Database with

  • 0

What I’ve done


I have a Gridview which is filled over my Database with the imageID’s. Now I setted up a onItemClickListner with that I get the imageID -> this works!. Now I’d like to search my DB with that imageID, but it allways returns “null”, but that shouldn’t be because if filled my DB exactly with those imageID’s.
The Structure of the Table is that: RowID | SOURCE | INFO
In Info i stored the imageID’s

Question


How do I have to change Cursor that I can get the entries over INFO.
Down here you find the Code of my Cursor:

Code:


    //Es wird nach der ID des smiley gesucht.
    public Cursor getSmiley(String info) throws SQLException {

        Cursor mCursor =

        this.mDb.query(true, DATABASE_TABLE, new String[] { INFO, SOURCE,
                }, INFO + "=" + info, null, null, null, null, null);
        if (mCursor != null) {
            mCursor.moveToFirst();
        }
        return mCursor;
    }

How I get the imageID-back


    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Toast.makeText(SFilterConfigActivity.this, "" + position, Toast.LENGTH_SHORT).show();


    //Hier wird herrausgefunden welche ID das Bild hat und in den jeweiligen String gespeichert
    source = String.valueOf(v.getId());
    Log.v("IMAGEID", source);
    SmileyHelper.open();

    Cursor c = SmileyHelper.getSmiley(source);
    startManagingCursor(c);

        if (c != null){
            String size = String.valueOf(c.getCount());
            Log.v("WhatsInC", size);
        }


    if (c.moveToFirst()) { 
        do { 
        text = c.getString(c.getColumnIndex(SmileyDBAdapter.SOURCE));
        Log.v("WHATINTEXT", text);
        smiley = c.getString(c.getColumnIndex(SmileyDBAdapter.INFO)); 
        Log.v("WHATINSMILEY", smiley);
        } while (c.moveToNext());
    SmileyHelper.close();

Additional Information:

  1. WhatIsInC, returns “0”.

If you need more Code, just tell me
Thx for your help in advance!
Best Regards
safari

  • 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-26T04:22:51+00:00Added an answer on May 26, 2026 at 4:22 am
    public Cursor getEmpByDept(String Dept)
      {
       SQLiteDatabase db=this.getReadableDatabase();
       String [] columns=new String[]{"_id",colName,colAge,colDeptName};
       Cursor c=db.query(viewEmps, columns, colDeptName+"=?", 
        new String[]{Dept}, null, null, null);
       return c;
      }
    

    The db.query has the following parameters:

     1.String Table Name: The name of the table to run the query against
     2.String [ ] columns: The projection of the query, i.e., the columns to retrieve
     3.String WHERE clause: where clause, if none pass null
     4.String [ ] selection args: The parameters of the WHERE clause
     5.String Group by: A string specifying group by clause
     6.String Having: A string specifying HAVING clause
     7.String Order By by: A string Order By by clause
    

    So, in your query,

    this.mDb.query(DATABASE_TABLE, new String[] { INFO, SOURCE },INFO + " = '" + info + "'" , null, null, null, null, null);
    

    or

    this.mDb.query(DATABASE_TABLE,new String[] {INFO, SOURCE},INFO + " = ?",new String[]
    {info},null, null, null, null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) 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.