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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:57:07+00:00 2026-05-22T02:57:07+00:00

hi all m having a strange problem. i have a button and when i

  • 0

hi all m having a strange problem.

i have a button and when i set onClick Listener of it.
it gives me null Pointer Exception and application forcefully closes.
my code is

more = (Button) findViewById(R.id.moreButton);
System.out.println("BEFORE more listener CALL");
more.setOnClickListener(this);

Its so strange for me please can any one help?
stackTrace is Below:

05-17 13:28:54.141: ERROR/AndroidRuntime(1509): FATAL EXCEPTION: main
05-17 13:28:54.141: ERROR/AndroidRuntime(1509): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.sigmatec.finditnear/org.sigmatec.finditnear.customListView}: java.lang.NullPointerException
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at  android.os.Looper.loop(Looper.java:123)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at java.lang.reflect.Method.invokeNative(Native Method)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at java.lang.reflect.Method.invoke(Method.java:521)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at dalvik.system.NativeStart.main(Native Method)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509): Caused by: java.lang.NullPointerException
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at org.sigmatec.finditnear.customListView.onCreate(customListView.java:114)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-17 13:28:54.141: ERROR/AndroidRuntime(1509):     ... 11 more

UPDATED:

one more thing the Button that i am using has been taken from the answer from the link
How to add a footer in ListView?
i have used button instead of TextView Take a look at answer#2 at the end.

m using the Button from some other layout not from the one which has been set on setContentView. because i am using List and i want a button at the end of the list so i made a seperate .xml and used the following code to join it with the List Footer.
COde:

super.onCreate(savedInstanceState);
setContentView(R.layout.listview);

 ListView l1 = (ListView) findViewById(R.id.ListView01);
    View footerView = 
        ((LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layout_footer, null, false);

    l1.addFooterView(footerView);
    l1.setAdapter(adapter);
  • 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-22T02:57:08+00:00Added an answer on May 22, 2026 at 2:57 am

    if you add button in footerview so try this..

    more = (Button)footerview.findViewById(R.id.moreButton);
    System.out.println("BEFORE more listener CALL");
    more.setOnClickListener(this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iphone http://sharingdream.com/phone.jpg Dear all, I'm having a strange problem with an application I'm building
I have a MS-Visual Studio 2005 workspace having all c code. This application(exe) allocates
all. I'm having a bit of weird problem with client server program. I have
I am having a strange problem in my code. I have many asserts scattered
I am having a kinda strange problem. Here is the situation. I have a
I am having this strange problem: I have just developed a WCF service (on
I'm having a strange problem. I have a method that sends off notifications by
I've been having a strange problem that I've never seen before. Now I have
Having a really strange problem. Scenario: PHP5.2.9, IIS7, PHP running as FastCGI. I have
I'm having a strange issue with my application for Mac OS X. I have

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.