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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:15:57+00:00 2026-06-04T20:15:57+00:00

I’m getting the following errors in my app, and I think it has to

  • 0

I’m getting the following errors in my app, and I think it has to do with the way I did the layout files, or used them in my code.

05-31 13:39:59.283: E/AndroidRuntime(332): Uncaught handler: thread main exiting due to uncaught exception
05-31 13:39:59.293: E/AndroidRuntime(332): java.lang.NullPointerException
05-31 13:39:59.293: E/AndroidRuntime(332):  at com.dd.qsg.ShowAchievements$AchievementAdapter.bindView(ShowAchievements.java:38)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.CursorAdapter.getView(CursorAdapter.java:186)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.AbsListView.obtainView(AbsListView.java:1274)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.ListView.measureHeightOfChildren(ListView.java:1147)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.ListView.onMeasure(ListView.java:1060)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.View.measure(View.java:7964)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:619)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:280)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.View.measure(View.java:7964)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.View.measure(View.java:7964)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.View.measure(View.java:7964)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.View.measure(View.java:7964)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.ViewRoot.performTraversals(ViewRoot.java:763)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.os.Looper.loop(Looper.java:123)
05-31 13:39:59.293: E/AndroidRuntime(332):  at android.app.ActivityThread.main(ActivityThread.java:4363)
05-31 13:39:59.293: E/AndroidRuntime(332):  at java.lang.reflect.Method.invokeNative(Native Method)
05-31 13:39:59.293: E/AndroidRuntime(332):  at java.lang.reflect.Method.invoke(Method.java:521)
05-31 13:39:59.293: E/AndroidRuntime(332):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-31 13:39:59.293: E/AndroidRuntime(332):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-31 13:39:59.293: E/AndroidRuntime(332):  at dalvik.system.NativeStart.main(Native Method)

Here is the ShowAchievements class:

package com.dd.qsg;

import android.app.ListActivity;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

public class ShowAchievements extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.achievements);

        DatabaseHandler db = new DatabaseHandler(this);
        Cursor cursor = db.getAchievements(this);
        AchievementAdapter cursorAdapter = new AchievementAdapter(this, cursor);

        this.setListAdapter(cursorAdapter);
    } 

    private class AchievementAdapter extends CursorAdapter {
        public AchievementAdapter(Context context, Cursor c) {
            super(context, c);
        }

        @Override
        public void bindView(View v, Context context, Cursor cursor) {
            if(cursor.getString(cursor.getColumnIndex("completed")).equals("yes")) {
                TextView tv = (TextView) v.findViewById(R.id.achView1);
                tv.setTextColor(Color.GREEN);
            }
        }

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            LayoutInflater inflater = LayoutInflater.from(context);
            View v = inflater.inflate(R.layout.achievements, parent, false);
            return v;
        }
    }    
}

Here is the getAchievements() method that is within my DatabaseHandler class:

public Cursor getAchievements(Context context) {
    String selectQuery = "SELECT * FROM achievements ORDER BY _id asc";
    SQLiteDatabase db = this.getWritableDatabase();
    return db.rawQuery(selectQuery, null);
}

Here is my achievements layout:

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

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/android:empty"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text=""/>

</LinearLayout>

Here is my achievements_item layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/achView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="" />

</LinearLayout>

I’m assuming these errors are caused by how I did my xml files. Was I supposed to put the achView1 TextView inside of the achievements layout rather than the achievements_item layout? Should I remove the empty TextView from achievements?

  • 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-04T20:15:58+00:00Added an answer on June 4, 2026 at 8:15 pm

    v is null and tv is also null…so null pointer exeption…due to wrong xml refrence of layout file row i mean item.you should use R.layout.achievements_item.xml while inflating item, in newView method…

     View v = inflater.inflate(R.layout.achievements_item, parent, false);
                                        ^^^^^^^^^^^^^^^^^ 
    
            @Override
            public View newView(Context context, Cursor cursor, ViewGroup parent) {
                LayoutInflater inflater = LayoutInflater.from(context);
                View v = inflater.inflate(R.layout.achievements_item, parent, false);
                return v;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.