android - Sound not ringing on load of The Intent -


I'm calling this class from the other class using intent and I think this song "song.ogg" class .. Please help me

  The public square expands DetlsActivity activity {@Override Creates Secure Zero (Bundle Saved Instantstate) {super.onCreate (savedInstanceState); SetContentView (R.layout.detls_layout); GetActionBar () setDisplayHomeAsUpEnabled (true). Soundpool soundpull; Int soundID; Soundpull = new soundpool (10, audio manager. STREAM_MUSIC, 0); SoundID = soundPool.load (this, R.raw.song, 1); Audio Manager AudioManager = (Audio Manager) getSystemService (AUDIO_SERVICE); //soundPool.play(soundID,1f,1f,1,0,1f); Toast. Make Text (this, "Ringing Song", Toast. LNNHH_LOG). Show (); {AssetFileDescriptor assetFileDescriptor = this.getAssets (). Try OpenFd ("song.ogg"); SoundPool.load (assetFileDescriptor, 1); Toast.makeText (this, "played", Toast.LENGTH_LONG) .show (); } Hold (exception e) {log d. ("LOGCAT", "Exception song"); }  

  sound acoustics; Int soundID; Soundpull = new soundpool (10, audio manager. STREAM_MUSIC, 0); Toast. Make Text (this, "Ringing Song", Toast. LNNHH_LOG). Show (); Try {SoundID = soundPool.load (this, R.raw.song, 1); Int Waiting Limit = 1000; Int waitCounter = 0; Int throttle = 10; While (soundpull.play (soundID, 1.f., 1.f., 1, 0, 1.f) == 0and waitcontractor & lt; waitlist) {waitcountor ++; SystemClock.sleep (Throttle);} Toast. Maketext (this, "played" + Voice ID, Toast. LNNHH_LOG). Show (); } Hold (exception e) {log d. ("LOGCAT", "Exception song"); Toast. Maketext (this, "Exception" + E, Toast. LNNHHLog) Show (); }  

Replace your code with the above code Current code warns Dandruff Sample 1 is not ready , so check it during the position of the situation.

Here, your resource is in the raw folder so we can call soundID = soundPool.load (this, R.raw.song, 1); . If your resource is in the Asset folder, you can use the soundID = soundPool.load (getAssets (.) OpenFd ("song.ogg"), 1);


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -