I added the MediaPlayer.setDisplay() and I added a SurfaceView to my
ui.  Now I get "The application stopped unexpectedly."  I looked in
the debug log and the error says "NullPointerException".  Any help
would be great.

Here is the code.

        AssetFileDescriptor afd = getResources().openRawResourceFd
(R.raw.myvideofile);
        MediaPlayer mp = new MediaPlayer();
        SurfaceView sv = (SurfaceView)findViewById
(R.id.SurfaceView01);
        mp.setDisplay(sv.getHolder());
        try {
                mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),
afd.getLengt ());
                mp.prepare();
                } catch (IllegalArgumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IllegalStateException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        mp.start();


>
> Using MediaPlayer.setDisplay(). You'll need to add a SurfaceView to your UI.- 
> Hide quoted text -
>

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