0

Is there any quick way to know if an image is referenced or used in a Java class or XML layout? For example like if an image.9.png is used in a certain layout. Thanks.

Lawrence Gimenez
  • 2,662
  • 4
  • 34
  • 52

2 Answers2

3

in Eclipse you cam make Search Like below Step .

First Click your Current Project in which you would like to Search . Now Press Ctrl+H in windows that will open Search Dialog Window. Now you want to check bg.png used in your Project ,Search like below in

 @drawable/bg

This will search for all Layout and xml file which use this image.

Now for Search in java file you need to search with it's id which you give in xml file.

  R.id.yourimageId

Now in your case you can search your @drawable/image by Ctrl+h Dialog in Eclipse.

EDIT In ADT updated version Like ADT 16 we have lint tool it will give all warning for unused Resource .

 Issue: Looks for unused resources

you will find this warning in lint check . for More about Lint Refer this Link Lint Checker SO

Community
  • 1
  • 1
Herry
  • 7,037
  • 7
  • 50
  • 80
0

There's no way to do it via code. However, in Eclipse, if you delete the image (make sure you make a copy first) and build the project, you'll know the spots where you are missing it :)

waqaslam
  • 67,549
  • 16
  • 165
  • 178