android 动态获取ID通过Resources的 getIdentifier 方法
2013-04-12 21:47
330 查看
public int getIdentifier
(String name,
String defType,
String defPackage)
Added inAPI level 1
Return a resource identifier for the given resource name. A fully qualified resource name is of the form "package:type/entry". The first two components (package and type) are optional if defType and defPackage, respectively, are specified here.
Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.
Parameters
name | The name of the desired resource. |
---|---|
defType | Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type. |
defPackage | Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package. |
int The associated resource identifier. Returns 0 if no such resource was found. (0 is not a valid resource ID.)
相关文章推荐
- Android通过反射动态获取资源Id
- Android用getIdentifier方法获取资源ID
- Android编程实现通过反射获取资源Id的方法
- Android使用getIdentifier()获取资源Id的方法
- Android 利用getIdentifier()方法获取资源ID
- Android通过文件名动态获取id
- 【我的Android进阶之旅】Android使用getIdentifier()方法根据资源名来获取资源id
- 通过字段名称动态获取资源的id(将Android工程做成jar包和资源文件)
- Android系列之网络(一)----使用HttpClient发送HTTP请求(通过get方法获取数据)
- Android:资源 id 及资源 id 的动态获取
- Android系列之网络(一)----使用HttpClient发送HTTP请求(通过get方法获取数据)
- Android获取设备唯一ID的方法
- Android之网络----使用HttpClient发送HTTP请求(通过get方法获取数据)
- Android_使用getIdentifier()获取资源Id
- Android 通过资源名,获取资源ID
- Android 通过resource名称或者layout中定义的id name 去获取R.java中id,得到控件
- Android 获取资源ID方法,SDK开发中利用getIdentifier()方法获取资源ID
- Android开发之通过反射获取到Android隐藏的方法
- Android通过崩溃日志中控件id定位崩溃位置的方法
- android 通过字符串来获取R下面资源的ID 值