1. Are you ready for the Galaxy S20? Here is everything we know so far!

Menu problems/ Splash

Discussion in 'Android Development' started by sigurros, Aug 12, 2010.

  1. sigurros

    sigurros Newbie
    Thread Starter



  2. blundell

    blundell Well-Known Member

    Your returning true in your onTouchEvent method, and you don't call the super. This is saying you have dealt with any event from the splashscreen, you may want to change this.
     
  3. blundell

    blundell Well-Known Member

    I'd also recommend you a better splashscreen implementation:
    Code (Text):
    1.  
    2. public class Splash extends Activity {
    3.  
    4.         // time in milliseconds
    5.         private static final long SPLASH_TIME_NO_USER_INTERACTION = 2000;
    6.         private static final int STOPSPLASH = 0;
    7.  
    8.         private static ImageView splash;
    9.        
    10.         /** Called when the activity is first created. */
    11.         @Override
    12.         public void onCreate(Bundle savedInstanceState) {
    13.                 super.onCreate(savedInstanceState);
    14.                 setContentView(R.layout.splash);
    15.                
    16.                 splash = (ImageView) findViewById(R.id.splashscreen);  
    17.                
    18.                 final Message msg = new Message();
    19.                 msg.what = STOPSPLASH;
    20.                 splashHandler.sendMessageDelayed(msg, SPLASH_TIME_NO_USER_INTERACTION);
    21.         }
    22.  
    23.         private Handler splashHandler = new Handler() {
    24.                 public void handleMessage(Message msg) {
    25.                         switch (msg.what) {
    26.                                 case STOPSPLASH:
    27.                                         goPastSplash();
    28.                                 break;
    29.                         }
    30.                 }
    31.         };
    32.  
    33.         private void goPastSplash() {
    34.                 splash.setVisibility(View.GONE);
    35.                 this.finish();
    36.                 Intent mainMenu = new Intent(getBaseContext(), MainMenu.class);
    37.                 startActivity(mainMenu);                
    38.         }
    39.  
    40. }
    41.  
     
Loading...

Share This Page

Loading...