0

在第一个活动上启动应用程序时,我收到带有应用程序名称的黑屏如何解决它,请建议我..

        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>
4

1 回答 1

0

检查代码中的 onCreate()、onStart() 和 onResume() 方法,您可能正在执行一些耗时的阻塞任务。在单独的线程上加载繁重的后台任务。

使用Traceview 和 dmtracedump 分析您的代码,以检查哪些需要更多时间。

于 2013-03-09T07:04:47.183 回答