package com.duncan.hello.world;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.duncan.hello.world.R;
public class HelloWorldActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Button aButton;
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
aButton = (Button) this.findViewById(R.id.button1);
aButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(HelloWorld.this, OtherActivity.class);
startActivity(i);
}});
}
}
버튼을 가져 왔기 때문에 오류가 하나뿐입니다. 오류가 23 행에 있으며 "HelloWorld를 유형으로 해결할 수 없습니다"라고 표시됩니다.이 오류에 대해 어떻게해야합니까?
당신은 선발 : 건설하지 질문에 대한 –
-1 위해 사용하는 클래스를 가져올 수
는 다음 코드 이상 교체,이 코드를 교체합니다. – WilHall이것은 내 마지막 질문에서 얻은 자습서에서 나온 것입니다. 그러니 제게 소리 지르지 마십시오. –