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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:09:58+00:00 2026-05-26T03:09:58+00:00

While running the application I’m getting these errors 10-09 10:20:57.138: ERROR/AndroidRuntime(282): java.lang.RuntimeException: Unable to

  • 0

While running the application I’m getting these errors

10-09 10:20:57.138: ERROR/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rika/com.rika.LatihanActivity}: java.lang.NullPointerException

10-09 10:20:57.138: ERROR/AndroidRuntime(282): Caused by: java.lang.NullPointerException

Please anyone help me to solve this problem.

Its the activity class

public class LatihanActivity extends Activity{
    private RadioButton radioButton;
    private TextView quizQuestion;  
    
    private int rowIndex = 1;
    private int questNo=0;
    private boolean checked=false;
    private boolean flag=true;
    
    private RadioGroup radioGroup;
    
    String[] corrAns = new String[5];
    
    final DatabaseHelper db = new DatabaseHelper(this);
    
    Cursor c1;
    Cursor c2;
    Cursor c3;

    int counter=1;
    String label;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        String options[] = new String[19];
  
        final RadioGroup radiogroup = (RadioGroup) findViewById(R.id.rdbGp1);
    
         // layout params to use when adding each radio button
         LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams(
                    RadioGroup.LayoutParams.WRAP_CONTENT,
                    RadioGroup.LayoutParams.WRAP_CONTENT);
    
        try {
            db.createDataBase();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        quizQuestion = (TextView) findViewById(R.id.TextView01);
                
        displayQuestion();
                     
        /*Displays the next options and sets listener on next button*/
        Button btnNext = (Button) findViewById(R.id.btnNext);
        btnNext.setOnClickListener(btnNext_Listener);

        /*Saves the selected values in the database on the save button*/
        Button btnSave = (Button) findViewById(R.id.btnSave);
        btnSave.setOnClickListener(btnSave_Listener);   

        c3 = db.getCorrAns();

        for (int i=0;i<=4;i++) {
            corrAns[i]=c3.getString(0);
            c3.moveToNext();
        }

        radioGroup = (RadioGroup) findViewById(R.id.rdbGp1);
         
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                // TODO Auto-generated method stub
                for(int i=0; i<radiogroup.getChildCount() ; i++) {
                    RadioButton btn = (RadioButton) radioGroup.getChildAt(i);                     
                    String text;
                              
                    if (btn.isPressed() && btn.isChecked() && questNo < 5) {
                        Log.e("corrAns[questNo]",corrAns[questNo]);
                        if (corrAns[questNo].equals(btn.getText()) && flag==true) {
                            flag=false;
                            checked = true; 
                        } else if(checked==true) {
                            flag=true;
                            checked = false;
                        }
                    }
                }   
            }
        });        
    }
          
    /*Called when next button is clicked*/
    private View.OnClickListener btnNext_Listener= new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            flag=true;
            checked = false;
            questNo++;
        
            if (questNo < 5) {
                c1.moveToNext();
                displayQuestion();
            }
        }

    };
    
    private View.OnClickListener btnSave_Listener= new View.OnClickListener() {
        @Override
        public void onClick(View v) {}
    };


    private void displayQuestion()  {
        //Fetching data quiz data and incrementing on each click
        
        c1=db.getQuiz_Content(rowIndex);
        
        c2 =db.getAns(rowIndex++);
            
        quizQuestion.setText(c1.getString(0));
            
        radioGroup.removeAllViews();
        for (int i=0;i<=3;i++) {
            //Generating and adding 4 radio buttons dynamically 
            radioButton = new RadioButton(this);
            radioButton.setText(c2.getString(0));
            radioButton.setId(i);
            c2.moveToNext();
            radioGroup.addView(radioButton);
        }
        
    }
}

All these issues happened when run the application

10-09 11:13:15.128: ERROR/HierarchicalStateMachine(68): TetherMaster – unhandledMessage: msg.what=3

10-09 11:13:56.556: ERROR/AndroidRuntime(282): FATAL EXCEPTION: main

10-09 11:13:56.556: ERROR/AndroidRuntime(282): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rika/com.rika.LatihanActivity}: java.lang.NullPointerException

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.ActivityThread.access$2300(ActivityThread.java:125)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.os.Handler.dispatchMessage(Handler.java:99)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.os.Looper.loop(Looper.java:123)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.ActivityThread.main(ActivityThread.java:4627)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at java.lang.reflect.Method.invokeNative(Native Method)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at java.lang.reflect.Method.invoke(Method.java:521)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at dalvik.system.NativeStart.main(Native Method)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): Caused by: java.lang.NullPointerException

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at com.rika.LatihanActivity.displayQuestion(LatihanActivity.java:198)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at com.rika.LatihanActivity.onCreate(LatihanActivity.java:69)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

10-09 11:13:56.556: ERROR/AndroidRuntime(282): … 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-26T03:09:58+00:00Added an answer on May 26, 2026 at 3:09 am

    Possibility 1 : you should declare your Acttivity on your Manifest File ,

    if you already did it and it still doesn’t work , you should declare it with the name of the package if you activity is in another package :

    <application ...>
    <activity android:name="YouPackageName.YourActivity" /> // it should be on the <application> tag
    </application>
    

    and at last , Clean and RE execute your project .

    Possibility 2 :

    make sure that your RadioButtonGroup is defined on your main.xml layout , if it is , soo make sure that you didn’t import the android.R ; you should use import YourPackage.R;

    and at last Clean and rebuild your project .

    NB : you didn’t give the full stack trace of your NullPointerException , so we can’t determine what is the exact problem in your code ,

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

Sidebar

Related Questions

I am getting the following error while running my MVC application, which uses the
I am getting following error while running my application which is asp.net. Server Error
I'm getting the following error while running the android application. Currently i'm using Windows
I am getting following error while running the application on the device: Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
I am getting an unusual error while running my application, just wondering if anyone
hi i am getting the following exception while running my application and my applicationContext.xml
My application is raising an unauthorized access error. While running my application, I try
I was trying http-cleint tutorials from svn.apache.org. While running the application I am getting
While running unit tests, I'm getting the MDA shown below. In the error message,
there is an error while i am running my application? can anybody tell me

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.