android - Login Screen blinks with Toast -


I created a login screen but before the screen on the screen I wanted an image to flash on the screen. For this, I use toast but the problem is for a while before the image login screen is shining, and then the image flash again appears in the login screen. I want to flash the image for the first time before any item appears in the screen. Here's my code:

  setContentView (R.layout.main); ImageView iv = New ImageView (this); Iv.setImageDrawable (.getResources () getDrawable (R.drawable.start)); Toast t = new toast (this); T.setView (iv); T.show (); T.setDuration (5);  

thanks lamp

using handler class to catch you The current login window requires a few seconds, the handler class provides a method, which can be used before the display of the display image,

if not possible with the handler method So, you can use on-start (such as on-start), much more activity methods

Here is some useful code for u.

  Personal handler handler; Personal last static string DEBUG_TAG = "splashScreen"; Crate on Public Zero (bundled savedinstenstate) {log. (DEBUG_TAG, "Creation executed ..."); Super.onCreate (savedInstanceState); SetContentView (R.layout.splashscr); Handler = new handler (); } Resume on Public Zero () {Log.i (DEBUG_TAG, "Honors executed ..."); Handler. PostDelayed (new runnabal) (public zero-less) {intent to myIntent = new intent (splashscreen.es, tabel class); Initialization (my entity);}}, 1000); Super.onResume (); } Start over protected void {super.start (); Logs. I (DEBUG_TAG, "performs onstart ..."); } Secure zero () {super. Logs. I (DEBUG_TAG, "executed onr ..."); } Protected void (cause) {super.onPause (); Logs. I (DEBUG_TAG, "On Pauses Implemented ..."); } Secure void onStop () {super.onStop (); Logs. Ii (DEBUG_TAG, "Onstop execution ..."); } Secure void onDestroy () {super.onDestroy (); Logs. Ii (DEBUG_TAG, "OndaStra implemented ..."); }  

}


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -