r brooks
r brooks

Reputation: 97

how do you find out what android resource is 0x7f040000 in eclipse?

Over the course of programming I get errors that give a resource number like "0x7f040000" (or sometimes in decimal form) My question is simple: Is there an easy way to tell what resource that is in eclipse?
i know i could manually identify every resource and print them out, but then every time i make a change to the program i'd have to update this code. Is there some way to search by resource ID?

Upvotes: 0

Views: 1428

Answers (4)

Jason Rogers
Jason Rogers

Reputation: 19344

YOu look up the R class in the gen folder

for example

public final class R {
    public static final class attr {
    }
    public static final class drawable {
        public static final int block=0x7f020000;

block is part or the drawables in the R file.

if you want to do this at runtime (and not just in the IDE of eclispe you can try

getResources().getResourceName(id);

Upvotes: 4

ariefbayu
ariefbayu

Reputation: 21979

you can use getResources() for that:

getResources().getResourceName( theID )

Upvotes: 2

WarrenFaith
WarrenFaith

Reputation: 57672

In your project structure, you should have a directory called gen. Browse that directory until you find the class R. There you find every resource of your project defined.

Another possibility is to go directly to the R class: Press ctrl + shift + T and in the popup you just type R. But be careful: There are at least two R classes listed there. One is from Android itself (package android.R) and your with the package name you have chosen.

Upvotes: 1

Ed Swangren
Ed Swangren

Reputation: 124642

Look at your R class and see what variable corresponds to that resource id. Right click -> Go To Definition.

Upvotes: 0

Related Questions