2

My question is suppose i have to views(Screen). when i open my application from the emulator first screen should stay for just 5 secs and automatically new screen should appear(2nd). i Know i can do this through timer concept but dnt know hwto do that in android? So pls help me in this problem.

EboMike
78k15 gold badges172 silver badges171 bronze badges
asked Sep 28, 2010 at 14:04
2
  • 1
    you looking to make a splash screen? Commented Sep 28, 2010 at 14:10
  • 2
    May I suggest against implementing a splash screen? I really don't want to wait 5 seconds when I start an app on a phone. This is not a desktop application. Commented Sep 28, 2010 at 14:14

1 Answer 1

1

I completely agree with EboMike about not showing a splash screen. It's a bad practice with any app (desktop or android) and often just covers up sloppy programming. Get the user to do useful work as soon as possible and do any other startup work asynchronously.

However, sometimes lawyers are in charge of software, sometimes it's a marketing person, and sometime you just can't defer long startup code. In this case, you need an answer. The simplest is to have your main activity be your splash scree. In the splash screen activity, create a handler to start your real main activity doing something like this:

 Handler handler = new Handler() {
 @Override
 public void handleMessage(Message msg) {
 super.handleMessage(msg);
 startActivity(...);
 finish();
 }
 };
 handler.sendEmptyMessageDelayed(0, 5000);
answered Sep 28, 2010 at 17:16
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.