0

您好,我一直在网上寻找答案,但我找不到任何东西...我很确定我正在这里做所有事情,所以这可能是一个问题,因为我使用的是模拟器?这是我的代码...我还在清单文件中添加了其他活动...

package com.example.help;
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;

public class GlavniIzbornik extends Activity {

Button settings;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu);
    settings = (Button)findViewById(R.id.bttnSettings);

    settings.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Intent settings = new Intent(GlavniIzbornik.this,TounamentSettings.class);
            GlavniIzbornik.this.startActivity(settings);
        }

    });
}

}

显现:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.tournamentpro"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.tournamentpro.GlavniIzbornik"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.example.tournamentpro.TournamentSettings" ></activity>
    </application>

</manifest>
4

1 回答 1

1

一切看起来都不错。请记住

  1. TounamentSettings 必须extends Activity
  2. TounamentSettings 必须在里面声明AndroidManifest.xml
于 2013-05-06T13:59:23.890 回答