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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:36:36+00:00 2026-05-25T10:36:36+00:00

I have the first activity that call a dialog from second activity with this

  • 0

I have the first activity that call a dialog from second activity with this code :

public class negozi extends ListActivity implements dati_punti{

    private Context context;
    private popup_segnala segnala;

        @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.negozi);
        context = this;
                    visual_pop(context);
          }
          public void visual_pop(Context context){
                  segnala = new popup_segnala(context);
                   segnala.showDialog(popup_segnala.OK_INSERT);
          }

the second activity, popup_segnala have this code :

public class popup_segnala extends Activity {
public static final int OK_INSERT = 1;
private static Context context;

public popup_segnala(Context context) {
   this.context = context;
}
@Override
protected Dialog onCreateDialog(int id) {
   switch(id){
   case OK_INSERT :
        Builder build_insert = createDialog(context,"Dati registrati correttamente. Grazie","Alert");
        build_insert.setPositiveButton("Ok", new DialogInterface.OnClickListener(){

             @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
           }
             });
      return build_insert.show();       
     }
    return null;
 }
}

Why ??? 🙁
I have this error log:

09-06 19:44:35.507: ERROR/AndroidRuntime(1657): 09-06 19:44:35.507:
ERROR/AndroidRuntime(1657): FATAL EXCEPTION: main 09-06 19:44:35.507:
ERROR/AndroidRuntime(1657): java.lang.NullPointerException 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Activity.getVolumeControlStream(Activity.java:3703) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Dialog.setOwnerActivity(Dialog.java:188) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Activity.onPrepareDialog(Activity.java:2491) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Activity.onPrepareDialog(Activity.java:2515) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Activity.showDialog(Activity.java:2565) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Activity.showDialog(Activity.java:2524) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
it.android.infoconsumatori.negozi.onOptionsItemSelected(negozi.java:65)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
android.app.Activity.onMenuItemSelected(Activity.java:2205) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:774)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
android.view.View$PerformClick.run(View.java:9152) 09-06 19:44:35.507:
ERROR/AndroidRuntime(1657): at
android.os.Handler.handleCallback(Handler.java:587) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.os.Handler.dispatchMessage(Handler.java:92) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
android.os.Looper.loop(Looper.java:123) 09-06 19:44:35.507:
ERROR/AndroidRuntime(1657): at
android.app.ActivityThread.main(ActivityThread.java:3687) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
java.lang.reflect.Method.invokeNative(Native Method) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): at
java.lang.reflect.Method.invoke(Method.java:507) 09-06 19:44:35.507:
ERROR/AndroidRuntime(1657): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
09-06 19:44:35.507: ERROR/AndroidRuntime(1657): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 09-06
19:44:35.507: ERROR/AndroidRuntime(1657): 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-05-25T10:36:37+00:00Added an answer on May 25, 2026 at 10:36 am

    Why do you create the class popup_segnala that extends Activity? You have to move onCreateDialog(int id) code in your main activity where you will simply call showDialog(OK_INSERT).

    Moreover onCreateDialog must return a dialog object.

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

Sidebar

Related Questions

I have some problem with passing a WebView from the first activity to the
I have an activity group which contains 2 activities. From first activity I goto
I currently have code that reads a recording in from the devices mic using
Right. I have an action that needs to call another activity. As I understand
I have First/Last/Previous/Next buttons that change the selected child node of a TreeViewItem. Setting
I have two strings: the first's value is catdog and the second's is got.
First of all I have to admit that my programming skills are pretty limited
I have an IList that contains items ( parent first ), they need to
I have an application that when it first starts i need it to run
The first activity in my app is a splash screen with a Progress Dialog

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.