A simple way would be to set SharedPreferences to null, eg:

SharedPreferences prefs = null;

String exception = prefs.getString("","");


On Wednesday, May 23, 2012 11:26:19 AM UTC-4, Fran wrote:
>
> Hi there, 
>
> Just for debugging my code I rather like to simulate the case an 
> exception is raised, and I do not know how to do it. 
>
> The code is the following: 
>
>         try { 
>             AssetFileDescriptor assetDescriptor = assets.openFd(filename); 
>             return new AndroidMusic(assetDescriptor); 
>         } catch (IOException e) { 
>             throw new RuntimeException("Couldn't load music '" + 
> filename + "'"); 
>         } 
>
> What I want to do is to force the IOException after 
>
> AssetFileDescriptor assetDescriptor = assets.openFd(filename); 
>
> So the code goes into the catch block. 
>
> How could I do that? 
>
> Thanks a lot in advance, 
>
>
>
>

-- 
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

Reply via email to