If you know for sure the activity will exist, there is no need to catch the exception.
On Tue, Jun 23, 2009 at 11:49 AM, n179911 <n179...@gmail.com> wrote: > > The JavaDoc of Context's public abstract void startActivity (Intent > intent) said: > > This method throws ActivityNotFoundException if there was no Activity > found to run the given Intent. > > But when I look at the android source code, it does not catch > ActivityNotFoundException. > > For example in AlarmClock.java: > > digitalClock.setOnClickListener(new OnClickListener() { > public void onClick(View v) { > if (true) { > Intent intent = new > Intent(AlarmClock.this, SetAlarm.class); > intent.putExtra(Alarms.ID, id); > startActivityForResult(intent, SET_ALARM); > } else { > // TESTING: immediately pop alarm > Intent fireAlarm = new > Intent(AlarmClock.this, AlarmAlert.class); > fireAlarm.putExtra(Alarms.ID, id); > > fireAlarm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); > startActivity(fireAlarm); > } > } > }); > > Can you please tell me what is the code which handles the case when > there is no activity for that intent? > > Thank you. > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---