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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:09:43+00:00 2026-06-09T19:09:43+00:00

Good day, I have like 2 question here: First a background information. from the

  • 0

Good day, I have like 2 question here:

First a background information.

from the android documentation, when querying a database, we have to return a column with name “_id” for it to work with a cursor adapter. Now in my implementation, lets say i have 3 columns “_id”, “column A” “column B”.

so if i have 8 entry rows in my database table, where the 1st 3 rows in column A is filled and the next 5 rows in column B is filled. if i query the database for column B and use the code below in my bindview, the cursor returns all the rows which will result in the first 3 entries being null and the last 5 items being shown in my gridview of images.

here is my bindView:

@Override
public void bindView(View view, Context context, Cursor cursor) {
     ViewHolder holder = (ViewHolder)view.getTag();
 int columnIndex = cursor.getColumnIndexOrThrow(columnName);
 final String name = cursor.getString(columnIndex);
     while(cursor.moveToNext()){

            if(name != null){
             Log.d(TAG, "string name in gridimageadapter is " + name);

             BitmapFactory.Options options = new BitmapFactory.Options();
             Bitmap bitmap = BitmapFactory.decodeFile(name);

             Bitmap newbitmap = Bitmap.createScaledBitmap(bitmap, 200, 200, false);
             if(holder.image != null){
                 holder.image.setImageBitmap(newbitmap); 
             }
             bitmap.recycle();

            }
     }
}

so my questions are:

  1. How do i write an sqlite query to return a column with rows not null? my current implementation is:

    public Cursor retrieveTag(String tag){

        String[] condition = {KEY_ID,tag};
    Cursor cursor = db.query(DATABASE_TABLE, condition, null, null, null, null, null);      
        return cursor;
    }
    
  2. from the BindView code, if i use this condition like

    if( !name.equals(null) || !name.equals(“”)){
    }

i get a NullPointerException on the it. Why is that?.. this is the correct way to test for Strings right?..

Hope am clear in my question and any help will be greatly appreciated. Thank you.

  • 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-09T19:09:45+00:00Added an answer on June 9, 2026 at 7:09 pm

    By using Sql query you can manage the data without null values see below code.

    Cursor c=db.rawQuery("Select columnB from tablename where columnB IS NOT NULL");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day, I have a question here. I am trying to fetch image from
Good day all I have the following question: I would like to use Chart
Hello and good day to all. I have a little question about like statement
Good day, I have like 15 images I need to be buttons. I have
Good Day, I have a Hibernate mapping that looks something like this: public class
Good day everyone. I have a question about making and using derived classes of
Good day! I have got a question about the Internet Explorer 9. Can anyone
Good day, I have a practical mysql question to which I can't find help
Good day, i have a meta like this <meta name=viewport content=initial-scale=1.0, maximum-scale=1.0, user-scalabale=no, width=device-width,
Good day, I have a fairly simple question to experienced C# programmers. Basically, 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.