Friday, November 2, 2012

[android-developers] Drawable.createfrompath not working!

Hi i m making an application in which i have put images in drawable folder the names of images are s5p1.jpg,s5p2.jpg,s5p3.jpg.
    User give two inputs in two EditTexts e.g 5 and 2.Now i convert this user input into s5p2 by concatenating with string.Now i am using Drawable .CreatePath method to get my required image from drawable  folder...But it couldn't show nothing.Here is my code.Please suggest me some solution.I know it is a simple problem.I simply google for 2 days but couldn't get much of it.

ImageView iv;
String  path="R.drawable.";
String concat="s"+input1+"p"+input2+".jpg";                    //              s5p2.jpg
path = path+concat;                                                      //               R.drawable.s5p2.jpg
Drawable d = Drawable.createFromPath(path);  
iv.setImageDrawable(d);

Please rep soon.
Thanks in advance.
Regards,
Talha Qamar.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate