Much appreciated that fixed the problem.

On Oct 26, 8:15 pm, Lance Nanek <[email protected]> wrote:
> Looks like you have to change this import:
>
> >import android.content.DialogInterface.OnClickListener;
>
> To this:
> import android.view.View.OnClickListener;
>
> This problem often happens when an IDE tries to import something for
> you, but picks the wrong thing. One thing you can do to help prevent
> that for these particular interfaces is to just include the parent
> interface whenever you refer to them. That would mean using
> "View.OnClickListener" instead of just "OnClickListener" in your code,
> for example.
>
> On Oct 26, 2:25 pm, tneufeld <[email protected]> wrote:
>
> > Hey,
>
> > I am attampting this tutorial from the official android dev site andI
> > am getting the following error: "The method setOnClickListener
> > (View.OnClickListener) in the type View is not applicable for the
> > arguments (new DialogInterface.OnClickListener(){})"  I checked and
> > rechecked the code aginst what it is telling me to put in and it looks
> > right, but it is still giving this error.  Cn anyone tell me what I am
> > missing?
>
> > Here is the following code:
>
> > package hello.form.stuff;
>
> > import android.app.Activity;
> > import android.content.DialogInterface.OnClickListener;
> > import android.os.Bundle;
> > import android.view.View;
> > import android.widget.ImageButton;
> > import android.widget.Toast;
>
> > public class HelloFormStuff extends Activity
> > {
> >     /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle savedInstanceState)
> >     {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.main);
>
> >         final ImageButton btn = (ImageButton)this.findViewById
> > (R.id.android_button);
>
> >         btn.setOnClickListener(new OnClickListener()
> >         {
> >             public void onClick(View v)
> >             {
> >                 // Perform action on clicks
> >                 Toast.makeText(HelloFormStuff.this, "Beep Bop",
> > Toast.LENGTH_SHORT).show();
> >                 }
>
> >         });
>
> >     }
>
> > }
>
> > Thanks,
>
> > Tim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to