我遇到了將啓動畫面包括到應用程序後未加載應用程序的問題。這是Manifest文件的SplashScreen.java &的代碼。我不知道我錯過了什麼。我經歷了這幾次,無法發現錯誤。我已經去過類似的帖子,但可以找到答案。請幫助啓動畫面後未加載應用程序
public class SplashScreen extends Activity {
private long ms=0;
private long splashTime=2000;
private boolean splashActive = true;
private boolean paused=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread mythread = new Thread() {
public void run() {
try {
while (splashActive && ms < splashTime) {
if(!paused)
ms=ms+100;
sleep(100);
}
} catch(Exception e) {}
finally {
Intent intent = new Intent(SplashScreen.this, TotalControl.class);
startActivity(intent);
}
}
};
mythread.start();
}
清單文件是如下
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tvganesh.totalcontrol.SplashScreen"
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.tvganesh.totalcontrol.TotalControl"
android:label="@string/app_name" >
</activity>
</application>
開機畫面,它顯示它應該切換到TotalControl.class後。但我得到消息「應用程序意外停止」
你能讓我知道我失蹤了嗎?
plz還添加logcat結果的問題,以獲得更多的幫助,我們 –
我不記得logcat O/P,但我認爲問題發生在onResumeGame()。我正在使用AndEngine –
你在哪裏更改暫停的變量? –