I think, a thread is usefull to switch from your splash screen to the
main menu. To fix your first problem, I've got no idea, unfortunately.
public class SplashScreen extends Activity {
private static final String TAG = "SplashScreen";
private static final int MAIN_MENU_ID = Menu.FIRST;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
class SleepClass implements Runnable {
public void run() {
try {
Log.i(TAG, "loading application");
Thread.sleep(3000); // wait 3 seconds
} catch (InterruptedException e) {
e.printStackTrace();
}
Intent myIntent = new Intent(SplashScreen.this,
YourMainApplication.class);
startActivity(myIntent);
}
}
Thread t1 = new Thread(new SleepClass());
t1.start();
}
}
On 11 Nov., 03:00, [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.
>
> If any can throw some light on this, it will be really helpful.
> P.S. I m doing this for my college project.
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---