|
|||||||
| Application Announcements A place for developers to announce new applications. |
|
|
||||||||
|
|
|
| Sponsors | |
|
|
#2 (permalink) | |
|
Junior Member
Join Date: Jan 2012
Posts: 32 Device(s): ZTE Skate
Thanks: 2
Thanked 1 Time in 1 Post
|
hey nice app, can i ask did you use mediaplayer or soundpool, if mediaplayer how did you stop the sounds from still playing when you click the home button?
Thanks! Will download this when i get my android phone |
|
|
|
|
|
|
#3 (permalink) | |
|
New Member
|
I used MediaPlayer. I have class with private static final MediaPlayer
and method which plays sound. Code:
private static final MediaPlayer mediaPlayer = new MediaPlayer();
public static void playSample(Context context, int resid) {
AssetFileDescriptor afd = context.getResources().openRawResourceFd(resid);
try {
mediaPlayer.reset();
mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getDeclaredLength());
mediaPlayer.prepare();
mediaPlayer.start();
afd.close();
} catch (IllegalArgumentException e) {
....
} catch (IllegalStateException e) {
....
} catch (IOException e) {
....
}
}
In next update i'll try to implement concurrent playback of sounds. I have some problems with it. |
|
|
|
|
![]() |
| Bookmarks |
| Tags |
| app sounds soundboard fun pop star |
| |||||||
| Thread Tools | |
|
|