对于我的 Android 应用程序,我在 AndroidManifest.xml 文件中声明了多个活动。
AndroidManifest.xml 文件是
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.btdt"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="@drawable/quizicon"
android:label="@string/app_name"
android:theme="@style/AppTheme" android:debuggable="true">
<activity android:name="QuizActivity"
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="QuizSplashActivity"> </activity>
<activity android:name="QuizGameActivity"> </activity>
<activity android:name="QuizHelpActivity"> </activity>
<activity android:name="QuizMenuActivity"> </activity>
<activity android:name="QuizScoresActivity"> </activity>
<activity android:name="QuizSettingsActivity"> </activity>
</application>
</manifest>
出于某种原因,我的应用程序从未出现在模拟器上。我已经阅读了其他人提出相同问题的答案,但我的应用程序仍然没有显示。我没有收到任何编译或运行错误。
如果有任何帮助,我的 QuizActivity.java 文件是
package com.example.btdt;
import android.os.Bundle;
import android.app.Activity;
import android.content.SharedPreferences;
import android.view.Menu;
import android.widget.TextView;
public class QuizActivity extends Activity {
TextView countDisplay;
public static final String GAME_PREFERENCES = "GamePrefs";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz_splash);
SharedPreferences settings =
getSharedPreferences(GAME_PREFERENCES, MODE_PRIVATE);
SharedPreferences.Editor prefEditor = settings.edit();
prefEditor.putString("UserName", "Ryan D'souza");
prefEditor.putInt("UserAge", 16);
prefEditor.commit();
countDisplay = new TextView(this);
this.setContentView(countDisplay);
if(settings.contains("UserName") == true)
{
String user = settings.getString("UserName", "Default");
countDisplay.setText(user);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.quiz_splash, menu);
return true;
}
}
谢谢您的帮助