Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Dynamically edit Uri for playing audio-files

Dynamically edit Uri for playing audio-files

All your problems with Audio, Video and Images.

Dynamically edit Uri for playing audio-files

Postby Danneman » Sun Oct 16, 2011 1:58 pm

I'm trying to play an mp3-file located in res/raw.

Problem is that I have a lot of audio that needs to be played dynamically.

This code does work for "mySound.mp3".

Code: Select all
mPlayer = MediaPlayer.create(main.this, R.raw.mySound);
mPlayer.start();


Whereas this code does NOT work:

Code: Select all
String soundName = "mySound";
Uri uri_soundName = Uri.parse("R.raw." + soundName);
mPlayer = MediaPlayer.create(main.this, uri_soundName);
mPlayer.start();


I've tried various other syntaxes to get the uri right, for instance:

Code: Select all
uri_soundName = Uri.parse("android.resource://com.myProject/myApp/raw/" + soundName);


...but to no avail.

Does anybody have an idea what I'm doing wrong?

Thanks,
Dan
Danneman
Junior Developer
Junior Developer
 
Posts: 24
Joined: Thu Mar 26, 2009 12:42 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 6 guests