Issues with OnClick Listener for Custom Dialog Box
<p>I am trying to write a custom dialog box that takes a name from the user. I am getting a "OnClickListener cannot be resolved to a type - The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new OnClickListener(){})" error in Eclipse. Anyone know what I am doing wrong?</p>

<p>Here is my Code:</p>

<pre><code>public void getName(){

         Dialog dialog = new Dialog(main.this);
         dialog.setContentView(R.layout.customdialog);
         dialog.setTitle("New Game");
         dialog.setCancelable(true);
         //there are a lot of settings, for dialog, check them all out!
         final EditText inputBox = new EditText(this);

         //set up text
         final TextView text = (TextView) dialog.findViewById(R.id.TextView01);
         text.setText("Enter Your Name...");


         //set up button
         final Button button = (Button) dialog.findViewById(R.id.namebutton);
         button.setOnClickListener(new OnClickListener() {
         public void onClick() {
             String str = inputBox.getText().toString(); 
             setName(str);
             }
         });
         //now that the dialog is set up, it's time to show it    
         dialog.show();
     }
</code></pre>
