onStart()上未加载Android布局

onStart()上未加载Android布局,android,layout,load,oncreate,onstart,Android,Layout,Load,Oncreate,Onstart,在显示后台时,我想运行一些操作(不使用线程) 在我的onCreate()活动中,我有setContentView(R.layout.splash) 当应用程序启动onStart()时,布局尚未加载。为什么? 更新:LogCat告诉我“活动已泄漏窗口” XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

在显示后台时,我想运行一些操作(不使用线程)

在我的
onCreate()
活动中,我有
setContentView(R.layout.splash)

当应用程序启动
onStart()
时,布局尚未加载。为什么?

更新:LogCat告诉我“活动已泄漏窗口”

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView android:src="@drawable/splash"
        android:id="@+id/image"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#ffffff" />
</LinearLayout>
onStart

@Override
protected void onStart() {
    super.onStart();


    if (CBConstants.ASSETS_MANAGER){

        String progressMsg = this.getResources().getString(R.string.progress_dialog_assets_upgrading_message);
        ProgressDialog progressDialog = ProgressDialog.show(this, null, progressMsg);

        progressDialog.show();

        try {

                            [...]

        } catch(Exception e) {
            Log.d("appcheck", ""+e);
            Intent intent = new Intent(SplashScreen.this, CBWebViewActivity.class);
            startActivity(intent);
        }


    }


    else {
        Thread noAssetManager = new Thread() {
        public void run() {
            try {

                while (splashActive && ms < splashTime) {
                    if(!paused)
                        ms=ms+100;
                    sleep(100);
                }

            } catch(Exception e) {
                if (LOG) Log.d("appcheck", ""+e);
            }
            finally {   
                Intent intent = new Intent(SplashScreen.this, CBWebViewActivity.class);
                startActivity(intent);
            }
        }
        };
        noAssetManager.start();
    }

}
@覆盖
受保护的void onStart(){
super.onStart();
if(CBConstants.ASSETS\u MANAGER){
String progressMsg=this.getResources().getString(R.String.progress\u对话框\u资产\u升级\u消息);
ProgressDialog=ProgressDialog.show(this,null,progressMsg);
progressDialog.show();
试一试{
[...]
}捕获(例外e){
Log.d(“appcheck”和“+e”);
意向意向=新意向(SplashScreen.this、CBWebViewActivity.class);
星触觉(意向);
}
}
否则{
线程noAssetManager=新线程(){
公开募捐{
试一试{
while(splashActive&&ms
如果logcat中出现一些错误,请发布这些错误,并发布您的代码或代码的相关部分。即使是布局xml,请问应用程序是否引发任何异常?可能您的活动未在清单文件中注册?更新:LogCat告诉我“活动已泄漏窗口”可能有不同的原因。您的“splash”映像有多大(大小以px和存储大小为单位)。如果您发布完整的logcat输出,这将非常有用,因为“Has leaked Window”通常只是由另一个错误引起的错误。。。。。
@Override
protected void onStart() {
    super.onStart();


    if (CBConstants.ASSETS_MANAGER){

        String progressMsg = this.getResources().getString(R.string.progress_dialog_assets_upgrading_message);
        ProgressDialog progressDialog = ProgressDialog.show(this, null, progressMsg);

        progressDialog.show();

        try {

                            [...]

        } catch(Exception e) {
            Log.d("appcheck", ""+e);
            Intent intent = new Intent(SplashScreen.this, CBWebViewActivity.class);
            startActivity(intent);
        }


    }


    else {
        Thread noAssetManager = new Thread() {
        public void run() {
            try {

                while (splashActive && ms < splashTime) {
                    if(!paused)
                        ms=ms+100;
                    sleep(100);
                }

            } catch(Exception e) {
                if (LOG) Log.d("appcheck", ""+e);
            }
            finally {   
                Intent intent = new Intent(SplashScreen.this, CBWebViewActivity.class);
                startActivity(intent);
            }
        }
        };
        noAssetManager.start();
    }

}