我是 android 的新手,我正在开发一个应用程序。我在单击按钮时将第 2 页链接到第 3 页时遇到问题。我曾试图解决这个问题,但它不起作用。下面是我的 AndroidManifest.xml `
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.fyp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".BelajarActivity"
android:label="@string/title_activity_main">
</activity>
<activity
android:name=".KnamaActivity"
android:label="@string/title_activity_main">
</activity>
</application>
</manifest>
下面是 BelajarActivity.java
package com.example.fyp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class BelajarActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.belajar);
Button bnama = (Button) findViewById(R.id.knama);
bnama.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
Intent namaIntent = new Intent(BelajarActivity.this,KnamaActivity.class);
startActivity(namaIntent);
}
});
}
}