In that case, the user will have to explicitly go back to your activity (e.g. By pressing the back button a couple of times). I usually do this on my first Activity in those kind of situations: Override public void onResume(){ super.onResume(); // first, check connectivity if ( isOnline ){ // do things if it there's network connection }else{ // as it seems there's no Internet connection // ask the user to activate it new AlertDialog. Builder(SplashScreen.
This) . SetTitle("Connection failed") . SetMessage("This application requires network access.
Please, enable " + "mobile network or Wi-Fi. ") . SetPositiveButton("Accept", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // THIS IS WHAT YOU ARE DOING, Jul SplashScreen.this.
StartActivity(new Intent(Settings. ACTION_WIRELESS_SETTINGS)); } }) . SetNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SplashScreen.this.finish(); } }) .show(); } } As you can see, I check the Internet connection in the onResume method, so that it will check if it user activated the WiFi or not.
In that case, the user will have to explicitly go back to your activity (e.g. By pressing the back button a couple of times). I usually do this on my first Activity in those kind of situations: @Override public void onResume(){ super.onResume(); // first, check connectivity if ( isOnline ){ // do things if it there's network connection }else{ // as it seems there's no Internet connection // ask the user to activate it new AlertDialog. Builder(SplashScreen.
This) . SetTitle("Connection failed") . SetMessage("This application requires network access.
Please, enable " + "mobile network or Wi-Fi. ") . SetPositiveButton("Accept", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // THIS IS WHAT YOU ARE DOING, Jul SplashScreen.this.
StartActivity(new Intent(Settings. ACTION_WIRELESS_SETTINGS)); } }) . SetNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SplashScreen.this.finish(); } }) .show(); } } As you can see, I check the Internet connection in the onResume method, so that it will check if it user activated the WiFi or not.
Great, thank you. Once the wifi is enabled, I still have to click the back button to get back to the main activity, but it's ok for me. – jul Jul 12 '10 at 17:42.
The first Activity that loads in my application is an initialization activity, and once complete it loads a new Activity. I want to ensure if the user presses 'Back' they go straight to the Launcher, and not the initialization screen. Side note, is this even the best approach, or would this be better done with some kind of Intent Flag?
Is it correct to call finish() after calling startActivity() on the new activity? I'm still taking in the whole 'Message Queue' method of doing things in Android, and my assumption is that calling startActivity() and then finish() from my first Activity's onCreate() will log each respective message in the message queue, but finish execution of onCreate() before moving on to starting the next Activity and finishing my first one. Is this a correct understanding?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.