Note that there are some explanatory texts on larger screens.

plurals
  1. POerror in onCreateDialog in Android
    primarykey
    data
    text
    <p>I have an error in onCreateDialog() NullPointerException in this code:</p> <pre><code>import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class More extends Activity{ static int DIALOG_ID=0; Dialog dialog = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.myfavourate); //showDialog(DIALOG_ID); } protected Dialog onCreateDialog(int id) { switch(id) { case 0: // do the work to define the pause Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.more); dialog.setTitle("Please Select One:"); Button btn_setting = (Button)findViewById(R.id.btn_more_setting); Button btn_about = (Button)findViewById(R.id.btn_more_about); Button btn_privacy = (Button)findViewById(R.id.btn_more_privacy); Button btn_cancel = (Button)findViewById(R.id.btn_more_cancel); btn_setting.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(More.this,SettingActivity.class); startActivity(intent); } }); btn_about.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(More.this,About.class); startActivity(intent); } }); btn_privacy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(More.this,Privacy_Policy.class); startActivity(intent); } }); btn_cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub More obj = new More(); obj.finish(); } }); break; default: dialog = null; } return dialog; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload