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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:47:39+00:00 2026-06-11T13:47:39+00:00

I have a problem and I am very confiused. I have a Dialog that

  • 0

I have a problem and I am very confiused. I have a Dialog that it contains a Button.
I show the dialog in main Activity with this code, so simple:

InfoDialog id=new InfoDialog(this);
id.show();

and I want when I click on Button, it starts the second activity. you see it is so easy, I use this code:

public class InfoDialog extends Dialog implements android.view.View.OnClickListener{

    Context context;

    public InfoDialog(Context context) {
        super(context);
        setContentView(R.layout.infodialog);
        this.context=context;
        setupViews();
    }

    private void setupViews() {
        Button button=(Button)findViewById(R.id.button1);
        button.setOnClickListener(this);    
    } 

    @Override
    public void onClick(View v) {

        switch (v.getId()){
        case R.id.button1:
            Intent newintent= new Intent(context,DestActivity.class);
            context.startActivity(newintent);
            break;  
    }
}

and I declare the destAct in Manifest too. when I run it on Gingerbread Android an older sdk versions it works fine. but when I run this code on ice cream sandwich (sdk 11) or higher it gives me force close!!!

this is my log cat:

08-27 09:38:54.540: W/dalvikvm(10945): threadid=1: thread exiting with uncaught exception (group=0x40a3d1f8)
08-27 09:38:54.544: E/AndroidRuntime(10945): FATAL EXCEPTION: main
08-27 09:38:54.544: E/AndroidRuntime(10945): java.lang.NullPointerException
08-27 09:38:54.544: E/AndroidRuntime(10945):    at my.app.InfoDialog.onClick(InfoDialog.java:131)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at android.view.View.performClick(View.java:3511)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at android.view.View$PerformClick.run(View.java:14105)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at android.os.Handler.handleCallback(Handler.java:605)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at android.os.Handler.dispatchMessage(Handler.java:92)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at android.os.Looper.loop(Looper.java:137)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at android.app.ActivityThread.main(ActivityThread.java:4575)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at java.lang.reflect.Method.invokeNative(Native Method)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at java.lang.reflect.Method.invoke(Method.java:511)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
08-27 09:38:54.544: E/AndroidRuntime(10945):    at dalvik.system.NativeStart.main(Native Method)

what the hell is this? please help me guys

  • 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-11T13:47:41+00:00Added an answer on June 11, 2026 at 1:47 pm

    finally i fix it. i used a handler and write startActivity codes on handler message receive. and in button’s onClick method just i sent a message to my handler. and it works fine on sdk>11. but i still dont now why my old code didnt work 😉

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

Sidebar

Related Questions

I have a big problem with very simple code. I need to get a
PROBLEM SOLVED: I was overlooking a very simple issue, and that is that this
I'm very confused and am hoping someone might have had this problem and be
I have a problem with OpenGl ES 2.0. I've designed a very simple framework
I'm very confused with this wee little problem I have. I have a non-indexed
I'm new in Jquery. I have a problem in my code, i'm very confused
i have very serious problem if any tech expert can help...thank you in advance..
I have very strange problem while I am submitting a practice problem on codechef.
have small problem, and would very much appreciate help :) I should convert byte
The problem seems very strange. I have a AJAX helper function within a same

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.