[EMAIL PROTECTED] wrote:
> Hi,
> I am developing a game.
> When the game starts, it shows one screen (Splashscreen).I have
> created xml file for that which contains only backgroudn. Nothing
> else.
> 
> I want that after some time (2 sec proabably), it should switch to the
> new view, which shows the menu for the game. Now I have created xml
> for that also.
> What I want is
> [1] When view for menu loads, and if user presses back, user should
> not get that splashscreen back.
> [2] The view should be changed automaticlly (from splash to menu). And
> I m not sure, that how can I do this. I googled and what I found is I
> have to create activities for each views and create diffrent java file
> for that and use Intent to call the view, But I don't find any code
> that properly explain this.

1. You can use ViewFlipper to hold both the splash screen and the menu 
in the same layout file. Then, in onCreate(), use View#postDelayed() to 
trigger a switch to the menu after so many seconds.

2. You apparently can call setContentView() multiple times without 
problems, though I have not tried this. So, in onCreate(), you would 
call setContentView() for the splash screen, then use View#postDelayed() 
to call setContentView() for the menu.

In either case, you have a single activity.

I have a blog post up describing the ViewFlipper technique, though it is 
for an older SDK and may require fixes to the poorly-formatted source code:

http://androidguys.com/?p=654

ViewFlipper also makes it easy to set up custom animations for 
transitioning from the splash screen to the menu.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.4 Published!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to