• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Having a little issue with creating buttons in Android.

I'm kinda new to creating Android apps, and right now I'm wondering about what's so difficult about asking the activity_main.xml file to recognize different elements in other files that I can't get the activity_main.xml to recognize a string I created in strings.xml. Here's a comparison of what's giving me the trouble:

This code gives me the string value it's supposed to:

[HIGH]<EditText android:id="@+id/edit_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/app_name" />[/HIGH]

And this code gives me a "Couldn't resolve resource @string/newgame" error:

[HIGH]<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/newgame" />
[/HIGH]

Here's what my strings look like right now:

<resources>

<string name="app_name">Blox32</string>
<string name="High_Scores">High Scores</string>
<string name="newgame">Start A Game</string>
<string name="score">Score: </string>
<string name="level">Level: </string>
<string name="settings">Settings</string>
</resources>
 
What software are you using?

If you are using eclipse, then try to clean the project. Maybe something for crisscrossed. It is in under Project -> Clean.

If that does not work try to change the string name from newgame to something different and reference that back to the your button
 
Back
Top Bottom