Null Pointer Exception when finding button on dialog?

You are calling findViewById on Dialog when it should be called on the Activity. Changing Button free = (Button) dialog. FindViewById(R.id.

Still_free) to Button free = (Button) findViewById(R.id. Still_free) should fix it.

You are calling findViewById on Dialog when it should be called on the Activity. Changing Button free = (Button) dialog. FindViewById(R.id.

Still_free); to Button free = (Button) findViewById(R.id. Still_free); should fix it.

Not really. He is calling findViewById on the dialog cause he is searching for a button in the dialog. So that code is correct.(If I understand right what he wants to do) – matsjoe Jul 9 at 13:53 when we customize any dailog, so we make xml according to need, I think he is use xml , and this xml part have a button , – Rajesh Sharma Jul 9 at 13:59 so first register these button he is using these code, – Rajesh Sharma Jul 9 at 14:01 Thats right, magicly solved it self I guess – Yuval Jul 9 at 14:01.

Try moving your code dialog. SetContentView(R.layout. Go_pro); Button free = (Button) dialog.

FindViewById(R.id. Still_free); free. SetOnClickListener(new OnClickListener() { //EXCEPTION HERE!

@Override public void onClick(View v) { dialog.cancel(); } }); to onCreate method of your Dialog class.

Button button1 = (Button) dialog. Intent intent = new Intent(Intent. Dialog.cancel();//TODO OPEN PAID APP HERE!

Button free = (Button)findViewById(R.id. SetOnClickListener(new OnClickListener() { //EXCEPTION ONLY HERE!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions