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 resolve resource id

dynamically resolve resource id

Problems with Canvas, OpenGL, etc...

dynamically resolve resource id

Postby oxyde » Fri Oct 08, 2010 11:01 am

Hey,

I have 52 png named 1.png, 2.png, ... Each representing 1 card.
In my game i know that i have to draw card number 37. How can i do that ? BitmapFactory.decodeResource(getResources(), ???)

Maybe i could use a map with keys = 1,2,3,.. and values R.drawable.1, R.drawable.2, ... but is there a clever way ?

thanks
oxyde
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Aug 11, 2010 1:28 pm
Location: paris, france

Top

Re: dynamically resolve resource id

Postby droid7 » Thu Oct 14, 2010 1:17 pm

you can try with:
String id = "1";
R.drawable.class.getField(id);
Visit my website: echlab software
droid7
Freshman
Freshman
 
Posts: 9
Joined: Thu Oct 14, 2010 1:03 pm

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests