1

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Brian
  • 385
  • 1
  • 5
  • 23
  • Does this answer your question? [JAVA XML - How do I get specific elements in an XML Node?](https://stackoverflow.com/questions/27031476/java-xml-how-do-i-get-specific-elements-in-an-xml-node) – Jan S. Nov 06 '19 at 15:52
  • 1
    No, but I didn't ask my question clearly enough. I edited it. Thanks for the answer. – Brian Nov 06 '19 at 16:04
  • Use `Ctrl + Left mouse button` and click on the ID. It will show you options – Vadim Kotov Nov 06 '19 at 16:05

1 Answers1

4

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62