0

I used this code for Splash screen Activity but the Log cat show me some Errors.

the code:

            @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();
        }

    }

Errors:

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
codeMagic
  • 44,549
  • 13
  • 77
  • 93
  • You are trying to run app which already running on device or emulator do one thing stop your app from device then rerun app – Pavan Aug 20 '15 at 15:43
  • Can you explain how can I do that? – kian mohammadi Aug 20 '15 at 15:45
  • @kianmohammadi just exit from your application and then run from eclipse or studio – Pavan Aug 20 '15 at 15:46
  • These aren't errors. Just warnings saying it's already running and there hasn't been any changes. Make a change, click run again, and watch it start up – codeMagic Aug 20 '15 at 15:49
  • @codeMagic Can you give me the old question that have a true answer.please?? – kian mohammadi Aug 20 '15 at 16:01
  • The linked dupe answers your question. If that is not the real question then you need to edit your post or make a separate question. If your splash activity isn't running (can verify with a log or breakpoint) then check your run configuration. You probably have your main activity set as the launcher – codeMagic Aug 20 '15 at 16:08

0 Answers0