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 reference the R.raw.-content?

Dynamically reference the R.raw.-content?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Dynamically reference the R.raw.-content?

Postby Danneman » Mon Mar 30, 2009 12:27 pm

Is it possible to dynamically reference a specific resource in the R.raw.-folder?

For instance, if I have an mp3 in the raw-foler named "hello.mp3" I can reference it in the code with:

Code: Select all
mp = MediaPlayer.create(getBaseContext(), R.raw.hello);


But how do I replace the last "hello" with the content of a variable, so that I can load different mp3's from R.raw with the same code?

Code: Select all
// CODE NOT WORKING
String soundFile = "helloagain";
String mpPath = "R.raw." + soundFile;
mp = MediaPlayer.create(getBaseContext(), mpPath);
Danneman
Junior Developer
Junior Developer
 
Posts: 24
Joined: Thu Mar 26, 2009 12:42 pm

Top

Postby Emmanuel7 » Mon Mar 30, 2009 11:57 pm

I'm far from being a java specialist, but I would say reflexion can be used for this kind of feature.
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests