The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (PinGou)代码
public class PinGou extends Activity  {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button goubutton=(Button)findViewById(R.id.goubutton);
        goubutton.setOnClickListener(this);
        
    }不懂了求教

解决方案 »

  1.   

    PingGou要实现OnClickListener才行。public class PinGou extends Activity
    改成
    public class PinGou extends Activity implements OnClickListener然后,在PinGou中实现OnClickListener中声明的onClick(View view)方法即可。
      

  2.   

    你要实现OnClickListener接口才能用this!还要复写onClick()方法。
    public class PinGou extends Activity implements  OnClickListener{
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
        
      Button goubutton=(Button)findViewById(R.id.goubutton);
      goubutton.setOnClickListener(this);
        
      }
    @Override
    public void onClick(View v)
    {
    //单击后你该做的事
    }