I quickly threw something together last night to see what the problem may
be.
I went from having a second class that loads the plays the MP3 file to this:
public class DemoGo extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageButton ib = (ImageButton) findViewById(R.id.ImageView01);
ib.setOnClickListener(onClickListener);
}
private OnClickListener onClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
MediaPlayer mp = MediaPlayer.create(v.getContext(), R.raw.a);
mp.start();
}
};}
Now I am not entirely sure why this works, I am thinking I might have been
using an incorrect View. Although this does play the media file, if you
click the button too many times the program still crashes.
On Tue, Jan 5, 2010 at 5:20 AM, Sean Hodges <[email protected]>wrote:
> Have you tried what I suggested?
>
> On Tue, Jan 5, 2010 at 4:47 AM, csaunders <[email protected]> wrote:
> > I am doing my development against Android 1.5 in the emulator. I
> > don't think it's anything 'special'.
> >
> > Also, the mp3 files aren't very large, they are about 7K each.
> >
> > On Jan 4, 4:57 pm, DulcetTone <[email protected]> wrote:
> >> Are you by any chance trying this on a Hero or Eris?
> >> The code you cite works fine for me EXCEPT on Hero and Eris (in which
> >> case, I think it works on SOME of them).
> >>
> >> I think the issue might indeed be that (some?) MP3 files fail on (some
> >> of?) these phones.
> >> I am myself working toward a "solution" that includes a fallback to a
> >> WAV file if the first create(idForMp3) returns null.
> >>
> >> tone
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
> >
> > NEW! Try asking and tagging your question on Stack Overflow at
> > http://stackoverflow.com/questions/tagged/android
> >
> > To unsubscribe from this group, send email to
> > [email protected]<android-beginners%[email protected]>
> > For more options, visit this group at
> > http://groups.google.com/group/android-beginners?hl=en
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>
--
Christopher Saunders
Linux and Open Source Enthusiast
blog.christophersaunders.ca
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en