• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Menu problems/ Splash

sigurros

Newbie
Jul 22, 2010
27
0
I'd also recommend you a better splashscreen implementation:
Code:
public class Splash extends Activity {

        // time in milliseconds
        private static final long SPLASH_TIME_NO_USER_INTERACTION = 2000;
        private static final int STOPSPLASH = 0;

        private static ImageView splash;
        
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.splash);
                
                splash = (ImageView) findViewById(R.id.splashscreen);   
                
                final Message msg = new Message();
                msg.what = STOPSPLASH;
                splashHandler.sendMessageDelayed(msg, SPLASH_TIME_NO_USER_INTERACTION);
        }

        private Handler splashHandler = new Handler() {
                public void handleMessage(Message msg) {
                        switch (msg.what) {
                                case STOPSPLASH:
                                        goPastSplash();
                                break;
                        }
                }
        };

        private void goPastSplash() {
                splash.setVisibility(View.GONE);
                this.finish();
                Intent mainMenu = new Intent(getBaseContext(), MainMenu.class);
                startActivity(mainMenu);                
        }

}
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones