Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android get resource type of id

I search for a way to say which resource type is behind a integer ID. For example i have the id of a drawable and another one for a color. I can load the drawable with Resource.getDrawable(id) and the color with Resource.getColor(ID) but how can i know which method is the right one for a given ID. I look for something like Resource.isColor(id)? Has anybody a good idea. I wrote a image loader which loads images from web, filesystem and drawables but now also from hex color or color ID.

like image 515
Happo Avatar asked Mar 21 '23 09:03

Happo


1 Answers

Check out this function from android Resources class. Resources.getResourceTypeName(int resid) (also this )

like image 81
Sipka Avatar answered Apr 08 '23 18:04

Sipka