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

The Archive Base Latest Questions

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

I created a class extending CursorAdapter, i am having problem on the bindView method.

  • 0

I created a class extending CursorAdapter, i am having problem on the bindView method.

@Override
public void bindView(View v, Context context, Cursor c) {


    int colNum = c.getColumnIndex(VidCallDbAdapter.QRLINK);
    String colValue = c.getString(colNum);

    System.out.println("value>> " + colValue);

    TextView name_text = (TextView) v.findViewById(R.id.qr_url);

    name_text.setText(colValue);

}

im always getting a NullPointerException in this line

TextView name_text = (TextView) v.findViewById(R.id.qr_url);

It’s weird because i defined qr_url on one of my xml.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content">

<TextView android:layout_height="wrap_content" 
          android:text=""   
          android:id="@+id/qr_url" 
          android:gravity="center_vertical" 
          android:layout_width="fill_parent" 
          android:textColor="#000000" 
          android:textSize="12sp">
</TextView>

</LinearLayout>  

Did i miss something on the code that’s why it’s a NullPointerException? Thanks in advance.

  • 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-26T07:50:56+00:00Added an answer on May 26, 2026 at 7:50 am

    If you are getting NullPointerException in this line

    TextView name_text = (TextView) v.findViewById(R.id.qr_url);
    

    it means that v is null, cause if TextView is not found null would be returned and NullPointerException would be thrown in

    name_text.setText(colValue);
    

    So make sure your public View newView(...) is overrided correctly.

    edit
    what you should return in newView is

    return inflater.inflate(R.layout.<name of your xml>, parent, false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a My custom listActivty by extending ListActivity like this. public class
I need to create class Dog and PurebredDog extending Dog. Problem is that Dog
I've created class that takes Exception type in constructor private readonly Exception _exception; public
I created a class that's something like this: public class MovieTheaterList { public DateTime
I created a class that extends ProfileBase: public class CustomerProfile : ProfileBase { public
I've created a custom view by extending View, it draws fine but When i
I have created a custom dialog box extending the DialogFragment class. As stated in
So I've created my own text pane class (extending JTextPane) and I'm using the
I created a class extending Application to have global variables in my app. I
I have been trying to override the database method of the loader class (CI_Loader).

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.