I have a list of Drawable stored in a Array. Now I would like to convert it into “res”(int datatype). Is this possible? Any help is appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re probably trying to get a resID from a random Drawable. If so then this is impossible – drawable doesn’t store IDs.
But if you use TypedArray to load your drawables from resources (i.e.
Resources.obtainTypedArray(R.array.your_imgs)) then you’ll be able to get resID by callinggetResourceId(int index, int defValue):