`
lee79
  • 浏览: 106460 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Accessing Android Resources By Name at Runtime

阅读更多

For example: I have a file bug.png in the "/res/drawable/ ", so i get its ResourceID with the following code:

 

int resID = getResources( ) .getIdentifier ( "org.anddev.android.testproject:drawable/bug" , null , null ) ;
// or
int resID = getResources( ) .getIdentifier ( "bug" , "drawable" , "org.anddev.android.testproject" ) ;

 

 

分享到:
评论

相关推荐

    Android.application.development

    Android was developed by the Open Handset Alliance, led by Google, and other companies. This tutorial will teach you basic Android programming and will also take you through some advance concepts ...

    android_隐藏API调用

    在Android系统中,除了公开的开发者API之外,还存在一些未公开或隐藏的API,这些API通常不包含在官方的开发者文档中,但有时对于特定功能的实现或者深入定制可能会非常有用。本篇将深入探讨如何理解和使用Android的...

    Android代码-boundbox

    BoundBox provides an easy way to test an object by accessing all its fields, constructors and methods, public or not. BoundBox breaks encapsulation. BoundBox has been designed with Android in mind. ...

    Accessing-Databases-JDBC

    这可以通过调用 `Class.forName()` 方法来完成。 2. **建立连接**:使用 `DriverManager.getConnection()` 方法建立与数据库的连接。此方法通常需要提供数据库 URL、用户名和密码作为参数。 3. **创建 Statement ...

    The Android Developer’s Cookbook: Building Applications with the Android SDK

    Already building Android applications and want to get better at it? This book brings together all the expert guidance–and code–you’ll need! Completely up-to-date to reflect the newest and most ...

    Android代码-Android版Spring框架

    By participating, you are expected to uphold this code. Please report unacceptable behavior to spring-code-of-conduct@pivotal.io. Features A REST client for Android Auth support for accessing secure ...

    Professional.Android.Sensor.Programming

    Professional Android Sensor Programming shows how to turn possibility into reality.The authors provide techniques that bridge the gap between accessing sensors and putting them to meaningful use in ...

    Android.App.Development.in.Android.Studio.Java.Android.Edition.For.Beginners.pdf

    After the Java lecture, 6 complete Android apps are developed again by step by step instructions.Each code line is explained. As the reader follows the development of the example apps, he/she will ...

    professional.Android.Application.Development.2009.pdf

    Chapter 10: Accessing Android Hardware 315 Using the Media APIs 316 Playing Media Resources 316 Recording Multimedia 317 Using the Camera 319 Controlling Camera Settings 319 Using the Camera ...

    CommonsWare.The.Busy.Coders.Guide.to.Android.Development.Version.8.2.2017

    Android, the next-generation open mobile platform from Google and the Open Handset Alliance, is poised to become a significant player in the mobile device market. The Android platform gives developers...

    一本android的好书beginning android 2 和 源码

    android好书系列,我目前找了两本,先贡献给大家。以后如果有好的资源,再上传和大家分享。 本资源是第一本。 这是一本学习android的好书,我浏览了,是老外著的,高清晰的pdf。为了方便大家学习android,我将本书所...

    ObjCRuntimeGuide

    One of its key features is the ability to handle dynamic behavior at runtime, which is managed by the Objective-C runtime system. The ObjCRuntimeGuide provides an in-depth look into how Objective-C ...

    The Android Developer's Cookbook Building Applications and Source Project

    Already building Android applications and want to get better at it? This book brings together all the expert guidance–and code–you’ll need! Completely up-to-date to reflect the newest and most ...

    MySQL 4th 原版PDF by DuBois

    of a good database system for managing and accessing information resources, many organizations have found them to be out of reach of their financial resources. Historically, database systems have been...

    Learn Java for Android Development 3rd Edition mobi格式

    Learn Java for Android Development, Third Edition, is an update of a strong selling book that now includes a primer on Android app development (in Chapter 1 and Appendix C, which is distributed in the...

    WebAssembly: Accessing C and C++ in Web Applications

    WebAssembly: Accessing C and C++ in Web Applications English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 1h 45m | 213 MB Accelerate web applications with native code using WebAssembly. WebAssembly is a ...

Global site tag (gtag.js) - Google Analytics