java - Transition to a black screen -


i believe have code set correctly when try debug it, after transitions splash screen goes right black screen. know imported layout correctly still goes black.

this code splash screen

package com.example.equate.jones;    import android.os.bundle; import android.app.activity; import android.content.intent; import android.view.menu; import android.view.menuitem; import android.support.v4.app.navutils;  public class ej_splash extends activity {      protected boolean _active = true;     protected int _splashtime = 3000;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_ej__splash);          // thread displaying splashscreen         thread splashtread = new thread() {             @override             public void run() {                 try {                         synchronized(this){                             wait(4000);                         }                      }                  catch(interruptedexception e) {                     // nothing                 } {                      finish();                      intent = new intent(getapplicationcontext(),ej_board.class);                     startactivity(i);                 }             }         };         splashtread.start();     }      @override     public boolean oncreateoptionsmenu(menu menu) {         getmenuinflater().inflate(r.menu.activity_ej__splash, menu);         return true;     }   } 

this code screen supposed transition to.

package com.example.equate.jones;  import android.app.activity; import android.media.mediaplayer; import android.os.bundle; import android.view.view; import android.widget.imageview;  public class ej_board extends activity {      private imageview button1;     final mediaplayer mp = mediaplayer.create(this, r.raw.warm);      /** called when activity first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.ej_board);           button1=(imageview)findviewbyid(r.id.imageview1);          button1.setonclicklistener(new view.onclicklistener()          {              public void onclick(view view)              {                   mp.start();              }         });     }  } 

this xml ej_board

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical" >      <imageview         android:id="@+id/imageview1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@drawable/ic_launcher" />  </linearlayout> 

i think problem imageview. need add image drawable folder, change android:src="@drawable/ic_launcher" name of image saved. give image need button. hope helps

edit:

for splash screen, try this:

public class splashactivity extends activity  {    private long splashdelay = 5000;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.splash);          timertask task = new timertask()         {              @override             public void run() {                 finish();                 intent homeintent = new intent().setclass(splashactivity.this, homeactivity.class);                 startactivity(homeintent);              }          };          timer timer = new timer();         timer.schedule(task, splashdelay);      } } 

then in home activity can set menu:

public class homeactivity extends activity {      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);      }     @override     public boolean oncreateoptionsmenu(menu menu) {         menuinflater inflater = getmenuinflater();         inflater.inflate(r.layout.menu, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle item selection         switch (item.getitemid()) {             case r.id.locationbutton:                 intent locationintent = new intent(this, locationactivity.class);                 startactivity(locationintent);                 return true;             case r.id.diningbutton:                 intent diningintent = new intent(this, diningactivity.class);                 startactivity(diningintent);                 return true;              case r.id.topxxvbutton:                 intent topintent = new intent(this, diningactivity.class);                 startactivity(topintent);                 return true;              default:                 return super.onoptionsitemselected(item);         }     } } 

try this:

public class splashactivity extends activity  {    private long splashdelay = 5000;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.splash);          timertask task = new timertask()         {              @override             public void run() {                 finish();                 intent mainintent = new intent().setclass(ej_splash.this, ej_board.class);                 startactivity(mainintent);              }          };          timer timer = new timer();         timer.schedule(task, splashdelay);      } } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -