public class Page1 extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
final Button button = (Button) findViewById(R.id.welcome);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = null;
myIntent = new Intent(view.getContext(), Page1.class);
startActivity(myIntent);
}
});
}
}
私はwelcome.xmlという名前の別のXMLファイルから内容をロードしたいのですが、私はエラーにwelcome cannot be resolved or is not a field
レイアウトは、Androidの[IDやフィールドは解決できない]
このPage1.javaクラスを得るかは、次の画面であります私のAndroidアプリケーションの
マイWelcome.xml
<Button android:text="@+id/Button01" android:id="@+id/welcome"
android:layout_width="wrap_content" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
</Button>