The native code was throwing IOException even in 1.0, but it wasn't a checked exception in Java. We felt it was best to expose it as a checked exception since it can occur under normal circumstances when another application or service has control of the camera.
On Apr 14, 11:10 pm, Tom Gibara <m...@tomgibara.com> wrote: > Camera.setPreviewDisplay() now throws an IOException. Is there a reason this > had to be a checked exception (looking at the source code I can't an see an > immediate one)? Or is it just an oversight that will be fixed before > releasing the final SDK? > The consequence is that one cannot have code that will compile for both 1.1 > and 1.5 without doing something ugly like adding a blanket try/catch, or a > dummy throw like: > > try { > mCamera.setPreviewDisplay(holder); > if (false) throw new IOException();} catch (IOException e) { > > /*handle exception*/ > > } > > Tom. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---