1

I have some activity handling the click event on any view

public class MainActivity extends Activity implements OnClickListener{
    ...
}

I have tried to override via this

public void onClick(View v)
{
    switch (v.getId())
    {
        case R.id.button1:
            mp.start();  
            break;
        case R.id.button2:
            mp.pause();  
            break;
        case R.id.button3:
            mp.stop();  
            break;
        default:
            break;
    }
}

But it is asking me to change to handle click event via

@Override
    public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub

        }

Has the api's changed , what is the issue I dont have any idea about ?

LearningBasics
  • 660
  • 1
  • 7
  • 24

1 Answers1

7

You need to import

import android.view.View.OnClickListener;

and not

import android.content.DialogInterface.OnClickListener;

See this

http://developer.android.com/reference/android/view/View.OnClickListener.html

Raghunandan
  • 132,755
  • 26
  • 225
  • 256