layout - Activity will run, but not show up (Android)? -


I'm just trying to test some stuff with a splash screen. The strange thing happens when I run the app. I can see my log message in the LogCat, but the activity itself will not appear. After the loop is over, it starts the next activity, which actually appears. If I comment on UIThread, it will show though. I know I'm doing something wrong, but I'm not sure what it is. idea?

XML:

  & lt; LinearLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "Match_parent" android: layout_height = "match_parent" Android: orientation = "horizontal" Android: background = "# 000000 "& Gt; & Lt; Android: paddingLeft = "50dp" Android: paddingTop = "50dp" Android: src = "@ drawable / logo": imageView android: id = "@ + id / logoIV" Android: layout_width = "wrap_content" android: layout_height = "wrap_content" />   

Java:

  spreads public class splash activity {@Override protected Zero onCreate (bundled savedInstanceState) {// TODO Auto -Created method stub super. Contents (Saved Instantstate); . GetWindow () addFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); RequestWindowFeature (Window.FEATURE_NO_TITLE); GetWindow () Set Flag (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); SetContentView (R.layout.splash); Find Last Image View Logo = (Image View) VVBIID (R. L. Line); Final difference [] animation = new int [6]; Anim [0] = R.drawable.logoa; Anim [1] = R.drawable.logob; Anim [2] = R.drawable.logoc; Anim [3] = R.drawable.logod; Anim [4] = R.drawable.logoe; Anim [5] = R.drawable.logof; RunOnUiThread (new Runnable) {int img = 0, counter = 0; up Boolean = true public zero run (while {from the counter} <21) {logo.setImageResource (anim [img]); if (up) {Img ++, if (img> = 5) above = false;} else {img--, if (img & lt; = 0) try up = true} {Thread.Sleep (150);} hold ( InterruptedException e) {e.printStackTrace ();} Counter ++; Log.e ("Tag", Integer.toString (counter));} If (counter> = 21) {intent creditsIntent = new intent (Splash. This, TitlePage.class); creditsIntent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP); Splash.this.startActivity (creditsIntent);}}}); } @ Override Protected Zero at POS () {// TODO Auto generated method Stub Super.Pano (); End(); }   

}

Change your embossed method like this Secure vs. Create (bundled savedinstenstate) {super.onCreate (savedInstanceState); . GetWindow () addFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); RequestWindowFeature (Window.FEATURE_NO_TITLE); GetWindow () Set Flag (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); SetContentView (R.layout.splash); Find Last Image View Logo = (Image View) VVBIID (R. L. Line); Final difference [] animation = new int [6]; Anime [0] = Ardroobel.Goa; Anime [1] = r.rrobal.blog; Anem [2] = r.rrobal.logoc; Anime [3] = ArradWebLog; Anem [4] = Ardroobel.Logo; Animation [5] = R. Droreable.Gloff; Thread t = new thread (new runnable) {int img = 0, counter = 0; = boolean true above; @override public zeros run (while {from counter} = 21) {runonutthread ) (Public zero-zero) {intent credit intent = no Intent (Splaskis, title page. Class) credit Intentksetflagj (Intentkflag_aktiviti_elaaraacpeepi); Splaskiskskriyta (CreditsIntent);}});}}}); T.start (); }

Comments