package com.example.applecounter;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.R.integer;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.transition.Fade;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
//Here start my code //
public class Play extends Activity implements OnClickListener {
int counter=0;
private MediaPlayer mplayer;
private TextView txt;
private static final int[] idArray = { R.id.imageButton1, R.id.imageButton2 };
private ImageButton[] bt = new ImageButton[10];
// This is oncreate() which works fine but the code for make an ImageButton array is not working and got the error.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play);
LinearLayout ll = new LinearLayout(context);
for (int i = 0; i < idArray.length; i++) {
final int b = i;
bt[b] = (ImageButton) findViewById(idArray[b]);
bt[b].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
}
}
}
當我導入ViewOnClickListener時,所以出現以下錯誤信息。 這裏有我的代碼,我得到了錯誤類型Play必須實現繼承的抽象方法View.OnClickListener.onClick(查看)
類型遊戲必須實現繼承的抽象方法 View.OnClickListener.onClick(查看)
你不會永遠不知道:D – Blackbelt
@blackbelt我沒有得到你的觀點需要編輯的東西嗎? – Raghunandan
只是一個笑話。沒關係 – Blackbelt