Can anyone tell me what is wrong with this code?

package infinite.fenix.android;

import java.io.IOException;

import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class AudioPlayer extends Activity implements OnClickListener {

        MediaPlayer player;
        ImageButton playButton, nextButton, previousButton;
        String audioFile = getString(R.raw.be_oss);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        playButton = (ImageButton) findViewById(R.id.playButton);
        playButton.setOnClickListener(this);
        player = new MediaPlayer();
        try {
                        player.setDataSource(audioFile);
                } catch (IllegalArgumentException e) {
                        Log.v("IlegalArgumentException", e.getMessage());
                        e.printStackTrace();
                } catch (IllegalStateException e) {
                        Log.v("IllegalStateException", e.getMessage());

                        e.printStackTrace();
                } catch (IOException e) {
                        Log.v("IOException", e.getMessage());
                        e.printStackTrace();
                }

                player.setLooping(false);
                try {
                        player.prepare();
                } catch (IllegalStateException e) {
                        Log.v("IllegalStateException", e.getMessage());
                        e.printStackTrace();
                } catch (IOException e) {
                        Log.v("IOException", e.getMessage());
                        e.printStackTrace();
                }


    }

        @Override
        public void onClick(View v) {

                if (player != null){
                        player.start();
                }
        }

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to