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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:01:09+00:00 2026-05-31T18:01:09+00:00

I have this code for an event handler: rbM.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton

  • 0

I have this code for an event handler:

rbM.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView,
                    boolean isChecked) {
                // TODO Auto-generated method stub
                if (isChecked) {
                    try {
                        Double.parseDouble(etAmm.getText().toString());
                        if (etPerc.getText().toString() != null
                                && etPerc.getText().toString() != "") {
                            etRis.setText(new Double(
                                    Double.parseDouble(etAmm.getText()
                                            .toString()) - percentuale())
                                    .toString());
                            etPercTot.setText(new Double(percentuale())
                                    .toString() + "%");
                        }
                        et30.setText(new Double(Double.parseDouble(etAmm
                                .getText().toString()) - percentuale(30))
                                .toString());
                        etPerc30.setText(new Double(percentuale(30))
                                .toString() + "%");
                        et50.setText(new Double(Double.parseDouble(etAmm
                                .getText().toString()) - percentuale(50))
                                .toString());
                        etPerc50.setText(new Double(percentuale(50))
                                .toString() + "%");
                        et70.setText(new Double(Double.parseDouble(etAmm
                                .getText().toString()) - percentuale(70))
                                .toString());
                        etPerc70.setText(new Double(percentuale(70))
                                .toString() + "%");
                    } catch (Exception ex) {
                    }
                }
            }

        });

I have it in the onCreate method, but when I start the application it crushes. Why??? Eclipse doesn’t give me any error and if I put a try catch block that tries everything in that method I get null as exception. My layout is correct because if I launch the application without any java code edited by me, it loads on the screen perfectly. Help me please!!!!!

p.s.
I have other event handlers but this is the shortest and I don’t think it might change from handler to handler, it’s always just a declaration.

Here’s the logcat as someone asked:

03-20 15:03:13.775: D/AndroidRuntime(262): Shutting down VM

03-20 15:03:13.775: W/dalvikvm(262): threadid=1: thread exiting with uncaught exception (group=0x4001d800)

03-20 15:03:13.895: E/AndroidRuntime(262): FATAL EXCEPTION: main

03-20 15:03:13.895: E/AndroidRuntime(262): java.lang.RuntimeException: Unable to start activity ComponentInfo{ciprianis.genius.percentuali/ciprianis.genius.percentuali.PercentualiActivity}: java.lang.NullPointerException

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.os.Handler.dispatchMessage(Handler.java:99)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.os.Looper.loop(Looper.java:123)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.ActivityThread.main(ActivityThread.java:4627)

03-20 15:03:13.895: E/AndroidRuntime(262):  at java.lang.reflect.Method.invokeNative(Native Method)

03-20 15:03:13.895: E/AndroidRuntime(262):  at java.lang.reflect.Method.invoke(Method.java:521)

03-20 15:03:13.895: E/AndroidRuntime(262):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

03-20 15:03:13.895: E/AndroidRuntime(262):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

03-20 15:03:13.895: E/AndroidRuntime(262):  at dalvik.system.NativeStart.main(Native Method)

03-20 15:03:13.895: E/AndroidRuntime(262): Caused by: java.lang.NullPointerException

03-20 15:03:13.895: E/AndroidRuntime(262):  at ciprianis.genius.percentuali.PercentualiActivity.onCreate(PercentualiActivity.java:62)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

03-20 15:03:13.895: E/AndroidRuntime(262):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

03-20 15:03:13.895: E/AndroidRuntime(262):  ... 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-31T18:01:10+00:00Added an answer on May 31, 2026 at 6:01 pm

    From what you say about line 62 it sounds like etAmm is null. Either you didn’t initialize it or FindViewById() couldn’t find it in your layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in a xaml file now in a event handler code
I have this code: public static String Download(string address) { WebClient client = new
When I write an event handler for csharp, it looks like this: public void
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
I have this code which is called at an onChange event of an function
Imagine I have this code: var myFunc1 = function(event) { alert(1); } var myFunc2
I have this code: $.getJSON(Featured/getEvents, function(data){ $.each(data.events, function(i,event){ var title = event.title.substr(0,20); $(#title-+i).text(Text); if
I have this jQuery code that queries an API on a keyup event (via
I have this js code: $(#startSearch).live(click, function(event) { $(input:checkbox[name='searchId']:checked).each(function() { var searchId = $(this).val();
Say I have this code: function onComplete(event, request, settings) { // How do I

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.