M19
M19

Reputation: 31

Splash screen functionality

I've made a splash screen for my pretty basic game app a while ago. It lasts for 5 seconds and I followed a tutorial for it.

What I want to do is make the splash screen last for 20 seconds, UNLESS the screen is tapped which I want to act as a 'skip' feature to skip the splash screen but allow the user to read the boring bits if they so wish.

My current code is:

public class StartScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.startscreen);
Handler x = new Handler();
x.postDelayed(new StartScreenHandler(), 5000);
}
class StartScreenHandler implements Runnable {
public void run() {
startActivity(new Intent(getApplication(), Menu.class));
};

Upvotes: 2

Views: 272

Answers (2)

Andro Selva
Andro Selva

Reputation: 54322

For this you have to make use of GestureDetectors. And you have to handle your event inside the onTouch event or singleTap event accordingly. Look here for an example.

http://android-journey.blogspot.com/2010/01/android-gestures.html

Upvotes: 1

Gaurav
Gaurav

Reputation: 1710

I am not sure about this, just guessing, try if it works. I suppose you must be having some image on the splash screen, just end the splash screen activity on the image's onClick event and call the next event. Try this and let me know

Upvotes: 0

Related Questions