Method: Android::Resource::ResTablePackage#find
- Defined in:
- lib/android/resource.rb
#find(res_id, opts = {}) ⇒ Object
Note:
This method only support string and drawable resource for now.
Note:
Always return nil if assign not string type res id.
find resource by resource id
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/android/resource.rb', line 221 def find(res_id, opts={}) hex_id = strid2int(res_id) tid = ((hex_id&0xff0000) >>16) key = hex_id&0xffff case type(tid) when 'string' return find_res_string(key, opts) when 'drawable', 'mipmap' drawables = [] @types[tid].each do |type| unless type[key].nil? drawables << @global_string_pool.strings[type[key].val.data] end end return drawables else nil end end |