`
lee79
  • 浏览: 103461 次
  • 性别: 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 UI开发专题

     对于Android平台的资源类android.content.res.Resources可能很多网友比较陌生,一起来看看SDK上是怎么介绍的吧,Contains classes for accessing application resources, such as raw asset files, colors, ...

    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调用

    按照压缩包中的隐藏API的文档说明,三方APP可以调用android的隐藏API

    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. ...

    Introduction.to.Android.Application.Development(4th,2013.12) pdf

    Accessing Resources Programmatically 142 Setting Simple Resource Values Using the Android IDE 143 Working with Different Types of Resources 146 Working with String Resources 147 Using String ...

    Android.Quick.APIs.Reference

    Storing and accessing data using Android APIs Accessing device location and using device sensors Recording and playing back video and audio content Accessing the camera Who this book is for This book ...

    Accessing-Databases-JDBC

    Accessing-Databases-JDBC:如何通过jdbc访问数据库,英文参考资料

    android-serialport-api

    Accessing serial ports for Android The current Android SDK does not provide any API for reading and writing to the Linux TTY serial ports. You may find such serial ports on the connector of HTC ...

    Android in Action

    3.3 Using resources 3.4 Understanding the AndroidManifest file 3.5 Summary 4 Intents and services 4.1 Working with Intent classes 4.2 Listening in with broadcast receivers 4.3 Building a Service 4.4 ...

    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 ...

    Android programming for beginners

    Book Details ISBN 139781785883262 Paperback 698 pages Book Description ...By the end of this book, you’ll be ready to start building your own custom applications in Android and Java.

    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,我将本书所...

    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.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 ...

    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...

Global site tag (gtag.js) - Google Analytics