Android Studio: No Bulb Icon to Give Resource_Name

+3 Dilraj Singh · January 15, 2016
Hi,

I was following one of Bucky's tutorial and at a point I had to set the Resource_Name of the Textview and a Button, but to set that I couldn't find the bulb Icon that appears just before the Widget. I need to set that in order to move ahead with the the tutorial.


/images/forum/upload/2016-01-15/e1eaf7310c2f528bd2faa0335a5a8bf8.PNG

Below are the lines present in the strings.xml file:

/images/forum/upload/2016-01-15/b43b36ce4ccc0c2e384c672692c92ba7.PNG

Please Help.

Regards,
DILRAJ

Post a Reply

Replies

Oldest  Newest  Rating
+1 Gary Whitney · January 16, 2016
I think I know what your are asking because I just tried it with a blank activity.
The TextView in the blank activity contained a literal string in the text property and no hint icon appeared.

It is considered a best practice to put text strings in the strings.xml and put a reference to them in the layout property
e.g.        android:text="@string/yourText"

apparently this version of Android Studio isn't annoying everyone with the little hint icon if you choose to use literal text.
You can, and should
1. add the string to strings.xml
2. reference it in the text property by using the ... icon on the right of the text property in the component explorer.
Or
1. reference it in the text property by using the ... icon on the right of the text property in the component explorer.
2. Then use the new Resource button to add the text to the strings.xml
+1 Paul Miil · January 28, 2016
if you change the default text from "Large Text" or "NEW BUTTON" to anything other than the default text the bulb will appear.
Apparently the bulb doesn't appear with default text on my version.. only when I change the literal text.
+1 Gary Whitney · January 19, 2016
Yes, Should is the keyword here.
If I am just banging out pseudo code then I don't bother.
BUT as I stated previously...
It is considered a best practice to put text strings in the strings.xml and put a reference to them in the layout property
e.g. android:text="@string/yourText"
This serves two purposes:
1. Your strings are only defined once and in one place.
2. If you ever publish and you want to change the strings based on location i.e. language
you can do that. (see the developer website for more information)
0 Dilraj Singh · January 19, 2016
Alright, so you mean to say that I should add the entry Manually in the strings.xml file?
  • 1

Java / Android Development

107,153 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator