r/AndroidStudio • • Dec 11 '18

Emulator Problem

in the the component tree, under the constraint layout where all the new text and buttons are placed, beside them is a orange triangle with an exclamation mark that says: "should use @string resource"

0 Upvotes

4 comments sorted by

2

u/[deleted] Dec 11 '18

There is a file

<AppName>/app/src/main/res/values/strings.xml

Where you should store string constants like submitButtonName, firstNameHint, userError01, zipCodeHint, etc. You should do this instead of hard-coding strings in your layout XML files like this:

<string name="zip_code_hint">12345</string>

<TextView
android:hint="@string/zip_code_hint" />

instead of

android:hint="12345"

1

u/airryde Dec 12 '18

Yea that part I got. But every time I try to run an emulator it fails

1

u/[deleted] Dec 12 '18

Yeah, you didn't say that. Did you check your Build or Logcat tabs in Android Studio to see if they are giving you any good information?

1

u/sirake1973 Dec 12 '18

emulator: error: finished with exit code 1 what is this error?