Reputation: 1928
It happens to me to declare widgets by id in XML files (@+id/widget
) and to forget in which XML file I have declared, especially when I have a lots of ids and XML files.
Usually I look for them in R.java
where they are nice sorted. But I see nowhere the XML file where they are declared. And I have to browse through all XML files which is annoying.
On right_click-> Open Declaration, R.java
is opened, at line:
public static final int widget=0x7f090012;
maybe this is the normal behaviour but
I wander if is there a way to get from R.java
in the XML file where I have declared the widget, like @+id/widget
. Or any other quick access method.
I'm using Eclipse, downloaded with "ADT Bundle".
Upvotes: 0
Views: 544
Reputation: 287
If you press the ctrl button while placing your cursor on the variable names in the R.java, the link to its corresponding xml file will pop up.
Upvotes: 0
Reputation: 15358
You can also get it from the root directory of all the xml files.
STEP 1: Select your layout folder,
STEP 2: Press Control+H
,
->enter your search keyword i.e. widget
// I have used btnDone
->select the scope
->Click on Search button
STEP 3: Look at the accurate results provided in Search
tab,
I hope it will be helpful !
Upvotes: 1
Reputation: 1332
in Eclipse environment
Upvotes: 1
Reputation: 10959
while pressing window/command key if you in macos or ctrl if you in windows move your mouse pointer to @+id/widget
and you will see different declaration places like :
/
you will see then different xml file where you declare that id. just click any of .xml file then
Upvotes: 4
Reputation: 1003
To avoid this kind of problem it's better to name your ids in correlation with the xml file name. For example if you have home.xml start your ids with "home_". You shouldn't need to go through R.java. You can do a file search with eclipse to find "@+id/widget".
Upvotes: 0
Reputation: 12444
Using Eclipse IDE, Hold CTRL key
and point the mouse the id
in your java code, then a list shown, -Open Deceleration in *
, example:
View v = findViewById(R.id.textView1);
hold ctrl
and point the mouse on textView1
.
if you are using MAC then use Command
instead Ctrl
Upvotes: 0
Reputation: 3312
In Eclipse, press Ctrl+H and type "@+id/widget". The search result will tell you all the files that contains "@+id/widget"....
Upvotes: 1