Resource id for Button widgets not added


#1

I added lines for id for the two Button widgets, as below. I saved activity_quiz.xml. But the id resources do not show up in R.java.

The id class does not look like what is shown in the book. It has action_settings instead of menu_settings as one of the id resources. But the other two auto generated resources for Buttons does not show up.

public static final class id {
public static final int action_settings=0x7f080000;
}

Any idea on what is the problem here?

It appears the resource menu_settings in strings.xml was an error. I changed it the action_settings and that fixed the error. The error on menu resource quiz.xml was resolved. The resource ids for true and false buttons also got generated.


#2

Glad you cleared up the issue.

This is definitely a tricky spot about dealing with resources. Any error anywhere in your resources will prevent all of your resources from building. This can be a little confusing - your layout file’s ids may not be generated for reasons having nothing to do with the layout file.


#3

Not sure the issue has been cleared up. In your book you explicitly say NOT to remove menu_setting and you don’t say anything about action_settings. Please clarify what needs to be added or removed and why.


#4

With the ADT I am using, strings.xml does not have an entry for menu_settings. It has instead an entry for action_settings.
I left that alone.


#5

Thanks a lot for this thread!

I also had the same issue and assume it is the later ADT and SDK. The book uses version 4.2 (API 17) looking at page xxi.

I checked my Eclipse here:
Eclipse -> Help -> About Eclipse Platform -> Android Robot.

Android Development Toolkit

Version: 22.3.0.v201310242005-887826

Eclipse -> Window -> Android SDK Manager:

SDK Android 4.4.2 (API 19)

Kind regards!


#6

I have the same problem, they don’t show up in the R.java
Please help

I am using API 19

[code]<?xml version="1.0" encoding="utf-8"?>

<string name="app_name">GeoQuiz</string>
<string name="question_text">Constantinople is the largest city in Turkey .</string>
<string name="true_button">True</string>
<string name="false_button">False</string>
<string name="action_settings">Settings</string>
[/code]

[code]




 [/code]

public static final class id { public static final int action_settings=0x7f080000; }


#7

[quote=“bennakhi”]I have the same problem, they don’t show up in the R.java
Please help

I am using API 19
[/quote]

Try closing ADT and opening it again.


#8

[quote=“atexit8”][quote=“bennakhi”]I have the same problem, they don’t show up in the R.java
Please help

I am using API 19
[/quote]

Try closing ADT and opening it again.[/quote]

Already did
I have been working on this for several days now


#9

I re-created the project from scratch and it works now, I fixed it :slight_smile: