| Author |
Message |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
|
| Back to top |
|
 |
cabernet1976 Senior Developer
Joined: 16 Nov 2007 Posts: 146 Location: China
|
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Sat Feb 09, 2008 6:12 am Post subject: |
|
|
Hi plusminus,
I'm modifying this tutorial to check user's Preferences after the boot process has finished. If the user set showLaunchOnStartup to True in Preferences, it will show LaunchOnStartup Activity, otherwise it won't show that screen. Any idea how can I do it?
Thank you very much in advance.
puyopuy
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Sat Feb 09, 2008 12:56 pm Post subject: |
|
|
hello plusminus,
Thank you for quick reply. I don't know why after I changed the codes like this:
| Java: |
@Override
public void onReceiveIntent(Context context, Intent intent) {
boolean showLaunchOnStartup = false;
if(showLaunchOnStartup){
/* Create intent which will finally start the Main-Activity. */
Intent myStarterIntent = new Intent(context, LaunchOnStartup.class);
/* Set the Launch-Flag to the Intent. */
myStarterIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
/* Send the Intent to the OS. */
context.startActivity(myStarterIntent);
}
}
|
Hello Word, LaunchOnStartup screen still showing, I expect that it will run at normal startup with out showing any window.
Am I did something wrong?
Thanks
puyopuy
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
Posted: Sat Feb 09, 2008 2:45 pm Post subject: |
|
|
Hello puyopuy,
I definitely think the reason for this weird behavior is, that your application(the intent-receiver) got registered with the system and not really updated with the following builds/pushes.
Try running your app after running the emulator-image once with "-wipe-data" under your projects Run-Configurations in Eclipses. That should fix it.
Regards,
plusminus
_________________
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Sun Feb 10, 2008 1:15 am Post subject: |
|
|
Hello plusminus,
I'm not sure is that what you mean. I put -wipe-data in command line options in Debug Configurations window. But the result still the same. I tried to put two break points one in LaunchOnStartup and the other in MyStartupIntentReceiver. I can see that LaunchOnStartup also called before MyStartupIntentReceiver.
| Java: |
public class LaunchOnStartup extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle); [b]<=break point[/b]
setContentView(R.layout.main);
}
}
|
| Java: |
public class MyStartupIntentReceiver extends IntentReceiver {
@Override
public void onReceiveIntent(Context context, Intent intent) {
boolean showLaunchOnStartup = false; [b]<=break point[/b]
if(showLaunchOnStartup){
/* Create intent which will finally start the Main-Activity. */
Intent myStarterIntent = new Intent(context, LaunchOnStartup.class);
/* Set the Launch-Flag to the Intent. */
myStarterIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
/* Send the Intent to the OS. */
context.startActivity(myStarterIntent);
}
}
}
|
Thanks again for your help
| Description: |
|
| Filesize: |
17.27 KB |
| Viewed: |
3292 Time(s) |

|
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
Posted: Sun Feb 10, 2008 1:12 pm Post subject: |
|
|
Hello puyopuy,
yes, that was what I was talking about. But even more weird that it still appears. Perhaps use the Logger (Log.d(..,..)) to ensure that the emulator is running the code you posted
What happens if you delete everything within onReceiveIntent
Regards,
plusminus
_________________
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Mon Feb 11, 2008 11:56 am Post subject: |
|
|
Hello plusminus,
I tested this application in a new VM image, without any Eclipse or Android SDK install. The result still the same. Can you duplicate this problem in your enviroment? Attached my source code that I used in my environment.
Thanks
Puyopuy
| Description: |
| My LaunchOnStartup source code |
|
 Download |
| Filename: |
LaunchOnStartup.zip |
| Filesize: |
33.11 KB |
| Downloaded: |
74 Time(s) |
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Tue Feb 12, 2008 8:44 am Post subject: |
|
|
Hi Plusminus,
The log only shown "Outside: showLaunchOnStartup=false", the problem is the main Activity(LaunchOnStartup) already created before onReceiveIntent. As I told you in Sun Feb 10, LaunchOnStartup's onCreate always called before onReceiveIntent. Just want to know do you have the same problem in your environment.
Thank you very much.
puyopuy
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Tue Feb 12, 2008 12:06 pm Post subject: |
|
|
Hi Plusminus,
I tried Run and Debug buttons they all the same. May I ask which button should I use?
Regards,
Puyopuy
|
|
| Back to top |
|
 |
plusminus Site Admin

Joined: 14 Nov 2007 Posts: 2067 Location: Germany
|
|
| Back to top |
|
 |
puyopuy Junior Developer
Joined: 03 Feb 2008 Posts: 17
|
Posted: Thu Feb 14, 2008 2:19 am Post subject: |
|
|
Thanks for your detailed explanation, I will test it again this week.
|
|
| Back to top |
|
 |
|