启动应用程序时的黑屏

时间:2013-03-09 06:50:14

标签: android

我在启动应用程序时在第一个活动中获取应用程序名称的黑屏如何解决它请建议我..

        I am getting black screen with application name at the time of launching application over the first activity how to resolve it please suggest me..

/ **首次创建活动时调用。 * /

@Override
public void onCreate(Bundle savedInstanceState)
{

super.onCreate(savedInstanceState);
ctx = this;
setVolumeControlStream(AudioManager.STREAM_MUSIC);
requestWindowFeature(Window.FEATURE_NO_TITLE);


Intent i = getIntent();
if (null == i || null == i.getExtras() ||
    !i.getExtras().containsKey("levels")) {

  activityCustomStarted = false;
  setContentView(R.layout.main);
  mGameView = (DroidGameView)findViewById(R.id.game);
} else {

  SharedPreferences sp = getSharedPreferences(
      FrozenDroid.PREFS_NAME, Context.MODE_PRIVATE);
  int startingLevel = sp.getInt("levelCustom", 0);
  int startingLevelIntent = i.getIntExtra("startingLevel", -2);
  startingLevel = (startingLevelIntent == -2) ?
                  startingLevel : startingLevelIntent;
  activityCustomStarted = true;
  mGameView = new DroidGameView(this, i.getExtras().getByteArray("levels"),
                           startingLevel);
  setContentView(mGameView);
}

mGameThread = mGameView.getThread();

if (savedInstanceState != null) {
  mGameThread.restoreState(savedInstanceState);
}
mGameView.requestFocus();

setFullscreen();

}

xml是

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<com.shagunstudio.bubbleshoot.DroidGameView
android:id="@+id/game"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</FrameLayout>

清单中的活动

<activity
android:name="com.shagunstudio.bubbleshoot.FrozenDroid"
android:alwaysRetainTaskState="true"
android:configChanges="orientation|keyboard"`enter code here`
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.FrozenDroid" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android``:name="com.shagunstudio.bubbleshoot.GAME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

1 个答案:

答案 0 :(得分:0)

检查代码中的onCreate(),onStart()和onResume()方法,可能会花费一些时间来阻塞任务。在单独的线程上加载繁重的后台任务。

使用Traceview and dmtracedump对您的代码进行分析,以检查需要花费更多时间的内容。

相关问题