Listing 5.4 seems incorrect


#1

List 5.4 on page 97 shows that you should add the following to AndroidManifest.xml:

The ‘/’ at the end seems incorrect. Removing the slash fixed the error I was seeing:

This also seems to be in line with QuizActivity’s <activity … > tag above it.


#2

I am using the listing exactly as in the book and it works fine.

As an experiment I tried removing the / from the closing >, and that generated an error.


#3

The listing shown in the book is valid XML.

Each XML tag has to have an opening and close tag like this: and with the attributes specified inside the opening tag

[quote] <activity
android:name=".CheatActivity"
android:label="@string/app_name"
>


[/quote]
There is another way of writing the same thing, as used in the book, where the opening tag is closed with a “/>” and therefore you need not specify the closing tag separately.

[quote]
<activity
android:name=".CheatActivity"
android:label="@string/app_name" />[/quote]

Perhaps you have added a tag below, which is why the / in the opening tag is giving you an error?