i have a program that shows a splash screen.But the problem is whenever i refresh same page again it appears.Is there any method to stop splash screen again and again.I want it just comes at first time not again and again. Thank you
A:
So you basically want the splash screen appear once per app launch. Here's a quick and dirty way:
- Subclass
android.app.Application
as, say,MyApp
; - Declare that class in
AndroidManifest.xml
(<application android:name=".MyApp" ... >
) so that it would get instantiated at app launch time; - Give it a
public static boolean SPLASH_SHOWN = false;
- Now, in your
Activity
'sonCreate()
check ifSPLASH_SHOWN = false
, show splash and set it totrue
.
alex
2010-02-18 06:27:55
if (SPLASH_SHOWN == false) { splash = (ImageView) findViewById(R.id.splashscreen); splash.setBackgroundResource(R.drawable.splash); Message msg = new Message(); msg.what = STOPSPLASH; splashHandler.sendMessageDelayed(msg, SPLASHTIME); splash.setVisibility(View.VISIBLE); SPLASH_SHOWN=true; }
RBADS
2010-02-18 12:05:47