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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:30:26+00:00 2026-06-14T10:30:26+00:00

I don’t know why I’m getting a null pointer -exception? This is where it

  • 0

I don’t know why I’m getting a null pointer-exception? This is where it origins:

int rgid = radioGroup.getCheckedRadioButtonId();

final Dialog dialog = new Dialog(MainSite.this);
dialog.setContentView(R.layout.upload_dialog);
dialog.setTitle("Upload - Einstellungen");
dialog.setCancelable(true);
//there are a lot of settings, for dialog, check them all out!

final EditText editname = (EditText) dialog.findViewById(R.id.filename);
editname.setText(filename);

//set up text
TextView tv_filesize = (TextView) dialog.findViewById(R.id.txt_filesize);
tv_filesize.setText("Dateigrösse: " + floata);             

RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup1);

int rgid = radioGroup.getCheckedRadioButtonId();

if(rgid == R.id.radio_apps){
    dirpath = dirpath + "_Apps/";
}

if(rgid == R.id.radio_pictures){
    dirpath = dirpath + "_Bilder/";
}

if(rgid == R.id.radio_other){
    dirpath = dirpath + "_Sonstiges/";
}

//set up button
Button cmd_save = (Button) dialog.findViewById(R.id.cmd_save);
cmd_save.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
        dialog.dismiss();
        final String[] file_save = {pathupload, editname.getText().toString(), dirpath};
        new UploadFile().execute(file_save);
    }

});

Button cmd_close = (Button) dialog.findViewById(R.id.cmd_close);
cmd_close.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
        dialog.dismiss();
    }

});
//now that the dialog is set up, it's time to show it    
dialog.show();

upload_dialog.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

<EditText
    android:id="@+id/filename"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    android:layout_marginTop="16dp"
    android:hint="Dateiname"/>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="In folgenden Ordner hochladen:" />

<RadioGroup
    android:id="@+id/radioGroup1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <RadioButton
        android:id="@+id/radio_apps"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="Apps" />

    <RadioButton
        android:id="@+id/radio_pictures"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Bilder" />

    <RadioButton
        android:id="@+id/radio_other"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sonstiges" />
</RadioGroup>

<TextView
    android:id="@+id/txt_filesize"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text=""
    android:textAppearance="?android:attr/textAppearanceLarge" />


<Button
    android:id="@+id/cmd_save"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Datei hochladen" />

<Button
    android:id="@+id/cmd_close"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Schliessen" />

LogCat:

11-16 14:44:07.215: E/AndroidRuntime(23721): FATAL EXCEPTION: main
11-16 14:44:07.215: E/AndroidRuntime(23721): java.lang.NullPointerException
11-16 14:44:07.215: E/AndroidRuntime(23721):    at com.mseiz.give.your.apps.MainSite$5.onItemClick(MainSite.java:226)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.widget.AdapterView.performItemClick(AdapterView.java:298)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.widget.AbsListView.performItemClick(AbsListView.java:1280)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3067)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.widget.AbsListView$1.run(AbsListView.java:3968)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.os.Handler.handleCallback(Handler.java:615)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.os.Handler.dispatchMessage(Handler.java:92)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.os.Looper.loop(Looper.java:137)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at android.app.ActivityThread.main(ActivityThread.java:4898)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at java.lang.reflect.Method.invokeNative(Native Method)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at java.lang.reflect.Method.invoke(Method.java:511)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
11-16 14:44:07.215: E/AndroidRuntime(23721):    at dalvik.system.NativeStart.main(Native Method)
  • 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-06-14T10:30:27+00:00Added an answer on June 14, 2026 at 10:30 am

    Work for me with your code

    final Dialog dialog = new Dialog(this);
            dialog.setContentView(R.layout.activity_main);
            dialog.setTitle("Upload - Einstellungen");
            dialog.setCancelable(true);
            // there are a lot of settings, for dialog, check them all out!
    
    
            RadioGroup radioGroup = (RadioGroup)dialog.findViewById(R.id.radioGroup1); // set dialog.findViewById instead findViewById
    
            int rgid = radioGroup.getCheckedRadioButtonId();
    
            if (rgid == R.id.radio_apps) {
            }
    
            if (rgid == R.id.radio_pictures) {
            }
    
            if (rgid == R.id.radio_other) {
            }
    
            // set up button
            // now that the dialog is set up, it's time to show it
            dialog.show();
    

    enter image description here

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

Sidebar

Related Questions

Don't know why this conversion fails. SELECT CAST('32.999' AS INT) throws the error saying
I don't know why, but this code worked for me a month ago... maybe
Don't know if anyone can help me with this or if it's even possible.
Don't know how to phrase this question but I need to modify the child
Don't know why this doesn't work. I can't do implicit animation for a newly
Don't know if this is the right place to ask this, but I will
Don't know why this is happening, but after submitting a form via JS (using
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question
Don't know what to do with this error. How to add data in SQL

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.