ERROR: "Cannot resolve character" @ string / edit_message "" Android Studio

I'm trying to follow the Android tutorial: http://developer.android.com/training/basics/firstapp/building-ui.html But when I get to the part where you need to add the button, my Android studio will return these errors :

Cannot resolve symbol '@string/edit_message' Cannot resolve symbol '@string/button_send' 

XML Code:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <EditText android:id="@+id/edit_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/edit_message" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" /> </LinearLayout> 

What am I doing wrong here? I cannot find the right solution on other stackoverflow issues, and I'm sure I used the correct code in the android tutorial from Google.

+5
source share
3 answers

You must define these 2 lines in strings.xml

  <?xml version="1.0" encoding="utf-8"?> <resources> ... <string name="edit_message">something text /string> <string name="button_send">something text</string> ... </resources> 
+6
source

Update the strings.xml file located under res / values ​​/

from

 <string name="edit_message">Edit</string> <string name="button_send">Send</string> 
+4
source

Follow these steps:

  • In Android Studio, from the res / values ​​directory, open the strings.xml file.
  • Add a row for the row named edit_message with a value of Enter Message.
  • Add a row for the row named "button_send" with a value of "Submit".

A source

-1
source

Source: https://habr.com/ru/post/1210396/


All Articles