How do I find ids in an xml file?

Brian :

This is a simple questions, but I couldn't figure out the answer, so hopefully someone can help. I looked for other questions addressing this, but didn't see any.

I'm familiarizing myself with a bunch of code written by someone else, and I'm trying to get a handle on what is happening. I run across a line like this:

mDeviceList = (ListView)findViewById(R.id.device_list); 

How can I find what element in one of the .xml layout files has the id device_list? I know I can open each file (there are a bunch of them) and click on each element, looking for the id, but is there a faster/simpler way to do this?

EDIT: I see how to do it programatically in other answers. I was looking how to find it within Android Studio. The correct/fast way is by clicking on the id, right-clicking, selecting go-go declaration, which then shows you where the id is declared.

justArandomUser :

On the code

(ListView)findViewById(R.id.device_list);

right click on the id (just id), and choose "find usage" , then you can see all the usage of this id in your project

or

right click on the id and choose "go to" and then choose "Declaration" and then you will be directed to the xml with that id

or , click on the id and press "ctrl+B" and it will do the same thing as above

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326302&siteId=1