[android-developers] Re: Drawable.createfrompath not working!
That function is expecting a file path:
public static Drawable createFromPath (String pathName)
Added in API level 1
Create a drawable from file path name.
It wants something like /mnt/sdcard/image.png
Sounds like you want to use assets.
On Friday, November 2, 2012 8:29:46 AM UTC-5, Talha Qamar wrote:
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.jpgDrawable 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