Error with on click view
<p>In my app i need to show dialogs for a lot of buttons. Therefore i decided to use 1 onClick for a series of buttons. Only the first line where we implement, there is an error. My code is as follows:</p>

<pre><code>import android.app.Activity;
import android.os.Bundle;
import android.app.AlertDialog;
import android.view.View;
public class Trial extends Activity implements View.OnClickListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        View b1 = findViewById(R.id.button1);
        b1.setOnClickListener(this);  
        View b2 = findViewById(R.id.button2);
        b1.setOnClickListener(this);  
    }
    View.OnClickListener yourListener = new View.OnClickListener() {
        public void onClick(View v) {
            if (v == button1) {
                new AlertDialog.Builder(v.getContext())
                        .setTitle("Paracettamol")
                        .setMessage(
                                "This medicine is generally used to cure Fever")
                        .setNeutralButton("OK", null).show();
            } else if (v == button2) {
                new AlertDialog.Builder(v.getContext())
                        .setTitle("sertraline")
                        .setMessage(
                                "This medicine is generally used to cure Head aches")
                        .setNeutralButton("OK", null).show();
            }


        }
    }
</code></pre>

<p>The fifth line(public class Trial extends Activity implements View.OnClickListener ) gives an error as follows:The type trial must implement the inherited abstract method View.OnClickListener.onClick(View). can anyone please help me.</p>
