Results 1 to 1 of 1
- 10-01-2011, 04:14 AM #1
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Loading soundpool and music in activity A and calling in Activity B
Hi!
Right now I am loading my tiny music clips in the same class that I am using it in like this:
================================================== ======================
public static final int A1 = 1;
public static final int A3 = 3;
private SoundPool soundPool;
private HashMap<Integer, Integer> soundPoolMap;
soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 100);
soundPoolMap = new HashMap<Integer, Integer>();
soundPoolMap.put(A1,soundPool.load(GameScreen_bugf ix.this, R.raw.a, 1));
soundPoolMap.put(A3,soundPool.load(GameScreen_bugf ix.this, R.raw.b, 1));
//etc
AudioManager mgr = (AudioManager) GameScreen_bugfix.this.getSystemService(Context.AU DIO_SERVICE);
float streamVolumeCurrent = mgr.getStreamVolume(AudioManager.STREAM_MUSIC);
float streamVolumeMax = mgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
float volume = streamVolumeCurrent / streamVolumeMax;
try {
soundPool.play(soundPoolMap.get(sound), volume, volume, 1, 0,
1f);
} catch (Exception e) {
e.printStackTrace();
}
================================================== ======================
Can someone please tell me how I can load all the soundclips in Activity A, and then call them in Activity B?
Thanks!
Ryan
Similar Threads
-
Passing Variable from a New Activity to an Old Activity
By rolledback in forum AndroidReplies: 1Last Post: 09-12-2011, 02:09 AM -
applet and system activity
By rafzio4 in forum New To JavaReplies: 0Last Post: 10-20-2010, 12:58 PM -
Help Please Override Activity with Android
By francojava1 in forum AndroidReplies: 2Last Post: 10-12-2010, 06:35 PM -
Learning Activity Management System 2.0.3
By levent in forum Java SoftwareReplies: 0Last Post: 06-05-2007, 11:44 AM -
Learning Activity Management System 2.0
By levent in forum Java SoftwareReplies: 0Last Post: 05-16-2007, 05:02 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks