活动开始错误

时间:2015-08-20 15:40:36

标签: android android-intent android-activity

我将此代码用于Splash屏幕Activity,但Log cat向我显示了一些错误。

代码:

            @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            Thread timer = new Thread(){
                @Override
            public void run() {
                super.run();
                try {
                sleep(3000);
            }catch(InterruptedException whatIsMyProblem){
                whatIsMyProblem.printStackTrace();
            }finally{Intent intent = new Intent(SplashActivity.this,MainActivity.class);
            startActivity(intent);
            }
        }   

        };
        timer.start();
        }

        @Override
        protected void onStop() {

            super.onStop();
            finish();
        }

    }

错误:

1-[2015-08-20 19:43:26 - TheAndroidApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.theandroidapp/.SplashActivity } 
2-[2015-08-20 19:43:26 - TheAndroidApp] ActivityManager: Warning: Activity not started, its current task has been brought to the front
3-[2015-08-20 19:43:27 - TheAndroidApp] ActivityManager: Warning: Activity not started, its current task has been brought to the front

0 个答案:

没有答案
相关问题