Problems in first android/java tutorial -
i getting started attempting learn eclipse java android programming. in fact, i'm working on first basic sample app in tutorial @ developer.android.com. have following activity_main.xml:
<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:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > android:orientation="horizontal" > <edittext android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" 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" android:onclick="sendmessage" /> </linearlayout>
and following strings.xml
<?xml version="1.0" encoding="utf-8"? > <resources> <string name="app_name">my first app2</string> <string name="edit_message">enter message</string> <string name="button_send">send</string> <string name="action_settings">settings</string> <string name="title_activity_main">mainactivity</string> <string name="title_activity_display_message">my message</string> <string name="hello_world">hello world!</string> </resources>
as can see have button_send string , edit_message string in strings.xml both referenced in activity_main.xml. however, build yields error "no resource found matches given name (at 'text' value '@string/button_send')". ideas, please?
here couple ideas:
- make sure strings.xml in res/values folder.
- clean project (project->clean). delete gen folder , re-generate it. time make change resources, it's idea clean project , regenerate of r.id.* values.
edit:
you can go eclipse gui xml file , right-click button. click "edit text", should bring string values. should able see button_send. if don't, there's issue strings.xml.
Comments
Post a Comment