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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:31:17+00:00 2026-05-30T19:31:17+00:00

I customized a header view in a ListView by using xml file, this file

  • 0

I customized a header view in a ListView by using xml file, this file is:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView 
        android:id="@id/post_title_tv" 
        android:paddingLeft="8.0dip" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Post title" 
        android:layout_alignParentLeft="true" />
    <ImageView 
        android:id="@id/post_fave_image" 
        android:paddingLeft="10.0dip" 
        android:paddingRight="8.0dip" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:visibility="gone"
        android:src="@drawable/btn_star_big_on" 
        android:layout_alignParentRight="true" />
</RelativeLayout>

then, I add it in my Listview by this code:

LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
        RelativeLayout headerLayout = (RelativeLayout)layoutInflater.inflate( R.layout.post_titl, null, false );

        postTitle = (TextView) findViewById(R.id.post_title_tv);
        postTitle.setText(postName);

then , when I run it, I get this error:

  03-04 14:52:41.946: E/AndroidRuntime(484): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.client.ui/com.google.client.ui.PostListView}: java.lang.NullPointerException
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.os.Looper.loop(Looper.java:123)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-04 14:52:41.946: E/AndroidRuntime(484):  at java.lang.reflect.Method.invokeNative(Native Method)
03-04 14:52:41.946: E/AndroidRuntime(484):  at java.lang.reflect.Method.invoke(Method.java:507)
03-04 14:52:41.946: E/AndroidRuntime(484):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-04 14:52:41.946: E/AndroidRuntime(484):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-04 14:52:41.946: E/AndroidRuntime(484):  at dalvik.system.NativeStart.main(Native Method)
03-04 14:52:41.946: E/AndroidRuntime(484): Caused by: java.lang.NullPointerException
03-04 14:52:41.946: E/AndroidRuntime(484):  at com.google.client.ui.PostListView.setComponent(PostListView.java:105)
03-04 14:52:41.946: E/AndroidRuntime(484):  at com.google.client.ui.PostListView.onCreate(PostListView.java:53)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-04 14:52:41.946: E/AndroidRuntime(484):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)

this is a NullPointerException, I can’t get the TextView resource in post_title.xml. The question is:
why can’t I get the TextView resource?

  • 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-30T19:31:18+00:00Added an answer on May 30, 2026 at 7:31 pm
    postTitle = (TextView)headerLayout.findViewById(R.id.post_title_tv);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to generate customized xml files from a template xml file in python.
I am creating a customized listview header that has the header text but also
When a class is customized, by using its outlet , you cant access its
We are developing customized installer using visual studio 2008 installer project. The requirement which
We are developing a customized installer using Wix and Wpf. We have developed some
A ListView with Datatemplate in GridViewColumn: <ListView Name =LogDataList IsSynchronizedWithCurrentItem=True ItemsSource={Binding LogDataCollection} Background=Cyan> <ListView.View>
In Android, is it possible to customize the header layout (the icon + a
I'm developing a website using WordPress as my Framework. The templates are highly customized
I am searching for a jquery image plugin like this site header has. I
I am using django-admin-tool to customized my django admin page. my problem is, how

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.