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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:48:48+00:00 2026-05-21T20:48:48+00:00

I was trying to clean up my listener(s) and got something wrong: I get

  • 0

I was trying to clean up my listener(s) and got something wrong: I get a typical ‘NullPoinerException’ in LogCat w/the bellow methods (first time trying to do it this way).

Any help? Thnx!

The Activity:

public class List_RegulatoryDocs extends Activity {

OnClickListener myClickListener = new OnClickListener() {
    @Override
    public void onClick(View v) {
        if (v == acItem) {
            Intent ACList = new Intent(List_RegulatoryDocs.this,
                    List_AC.class);
            startActivity(ACList);
        } else if (v == adItem) {
            // TODO
        }else if (v == cfrItem) {
            // TODO
        }//TODO + items
    }
};

/**
 * -- Called when the activity is first created
 * ===================================================================
 */
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.regulatory_docs_list);

    // Set the Click Listeners
    acItem.setOnClickListener(myClickListener);
    adItem.setOnClickListener(myClickListener);
    cfrItem.setOnClickListener(myClickListener);

}

/**
 * -- Local Variables
 * =====================================================================
 **/
RelativeLayout acItem = (RelativeLayout) findViewById(R.id.acItem);
RelativeLayout adItem = (RelativeLayout) findViewById(R.id.adItem);
 RelativeLayout cfrItem = (RelativeLayout) findViewById(R.id.cfrItem);
// RelativeLayout pmaItem = (RelativeLayout) findViewById(R.id.pmaItem);
// RelativeLayout saibItem = (RelativeLayout) findViewById(R.id.saibItem);
// RelativeLayout sfarItem = (RelativeLayout) findViewById(R.id.sfarItem);
// RelativeLayout stcItem = (RelativeLayout) findViewById(R.id.stcItem);
// RelativeLayout tsoItem = (RelativeLayout) findViewById(R.id.tsoItem);
// RelativeLayout tcdsItem = (RelativeLayout) findViewById(R.id.tcdsItem);
}

LogCat:

05-05 01:27:29.931: WARN/dalvikvm(13268): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268): FATAL EXCEPTION: main
05-05 01:27:29.971: ERROR/AndroidRuntime(13268): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.aeroTechnologies.flyDroid/com.aeroTechnologies.flyDroid.regList.List_RegulatoryDocs}: java.lang.NullPointerException
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.os.Looper.loop(Looper.java:123)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at java.lang.reflect.Method.invokeNative(Native Method)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at java.lang.reflect.Method.invoke(Method.java:521)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at dalvik.system.NativeStart.main(Native Method)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268): Caused by: java.lang.NullPointerException
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.Activity.findViewById(Activity.java:1637)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at com.aeroTechnologies.flyDroid.regList.List_RegulatoryDocs.<init>(List_RegulatoryDocs.java:51)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at java.lang.Class.newInstanceImpl(Native Method)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at java.lang.Class.newInstance(Class.java:1429)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
05-05 01:27:29.971: ERROR/AndroidRuntime(13268):     ... 11 more
  • 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-21T20:48:49+00:00Added an answer on May 21, 2026 at 8:48 pm

    Declare the acItem,adItem,cfrItem (as member vars if you like)
    then assign them in onCreate();

      public class List_RegulatoryDocs extends Activity {
    RelativeLayout acItem ;
    RelativeLayout adItem;
     RelativeLayout cfrItem ;
    OnClickListener myClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v == acItem) {
                Intent ACList = new Intent(List_RegulatoryDocs.this,
                        List_AC.class);
                startActivity(ACList);
            } else if (v == adItem) {
                // TODO
            }else if (v == cfrItem) {
                // TODO
            }//TODO + items
        }
    };
    
    /**
     * -- Called when the activity is first created
     * ===================================================================
     */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.regulatory_docs_list);
    acItem = (RelativeLayout) findViewById(R.id.acItem);
    adItem = (RelativeLayout) findViewById(R.id.adItem);
     cfrItem = (RelativeLayout) findViewById(R.id.cfrItem);
        // Set the Click Listeners
        acItem.setOnClickListener(myClickListener);
        adItem.setOnClickListener(myClickListener);
        cfrItem.setOnClickListener(myClickListener);
    
    }
    
    /**
     * -- Local Variables
     * =====================================================================
     **/
    
    // RelativeLayout pmaItem = (RelativeLayout) findViewById(R.id.pmaItem);
    // RelativeLayout saibItem = (RelativeLayout) findViewById(R.id.saibItem);
    // RelativeLayout sfarItem = (RelativeLayout) findViewById(R.id.sfarItem);
    // RelativeLayout stcItem = (RelativeLayout) findViewById(R.id.stcItem);
    // RelativeLayout tsoItem = (RelativeLayout) findViewById(R.id.tsoItem);
    // RelativeLayout tcdsItem = (RelativeLayout) findViewById(R.id.tcdsItem);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the Class methods of prototype.js to manage my object hierarchy
I am trying to clean up the objects which has status uncompleted. Then I
I'm trying to figure out a clean way of getting data back from my
I am trying to clear the value attribute of an 'Other' form input when
while trying to deploy a Grails application into tomcat6 I ran into some problems:
I'm trying to create a Help/About screen for my application, but I've discovered that,
I guess I haven't really had to do this much before because I am
In PostgreSQL, there is this very useful string_agg function, that allows query like: SELECT
Here is a simple opengl program by me. I'm trying to clear the screen
I'm trying to create a generic function to build a Linq expression from a

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.