[問題] @override onClick的error
開發層: (應用/框架/庫/核心)
Eclipse
問題:
輸入:
預期輸出:
錯誤輸出:
The method onClick(View) of type new View.OnClickListener(){} must override a
superclass method
錯誤訊息:
程式碼: (請多利用置底文網站)
package project.XYZWayCollect;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class XYZWayCollect extends Activity {
/** Called when the activity is first created. */
private Button writeButton;
private TextView myTextView1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
writeButton = (Button) findViewById(R.id.button1);
myTextView1 = (TextView) findViewById(R.id.TextView);
writeButton.setOnClickListener(new Button.OnClickListener(){
@Override //這邊出錯
public void onClick(View v){
myTextView1.setText("ABCD");
}
});
}
}
參考: (書籍/網頁/...)
補充說明:
我Google過了 大部分都是說Complier沒有調到1.6 可是我的已經是1.6了
完全不知道為什麼 是我安裝過程有問題嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.251.188.50
推
05/09 16:49, , 1F
05/09 16:49, 1F
→
05/09 16:49, , 2F
05/09 16:49, 2F
→
05/09 16:52, , 3F
05/09 16:52, 3F
→
05/09 16:53, , 4F
05/09 16:53, 4F
→
05/09 16:56, , 5F
05/09 16:56, 5F
→
05/09 16:56, , 6F
05/09 16:56, 6F
→
05/09 16:58, , 7F
05/09 16:58, 7F
→
05/09 17:00, , 8F
05/09 17:00, 8F
推
05/09 20:29, , 9F
05/09 20:29, 9F
AndroidDev 近期熱門文章
PTT數位生活區 即時熱門文章