Activity_quiz.xml file not opening


#1

Hello,

I recently bought the BNR book for Android programming and when I created my android project for the first activity eclipse never created a activity_quiz.xml file. I was wondering if anyone was having the same problem and could help me get back on track with this project.

Thanks!


#2

I had the same problem. Here’s what worked for me:

Go to this website:
developer.android.com/sdk/insta … g-adt.html

Follow the instructions under the header Download the ADT Plugin and then recreate the android application project and the activity_quiz.xml file should be there.

Hope this helps.


#3

Wonderful :smiley: that fixed it!
I have another question, why does my project create fragments whereas the book’s project does not create fragments?


#4

Thanks Yashmeelius. As I had the same issue after unzipping the ADT bundle on windows 8. Planning to spend most of this week on the kindle version of the book. Yes, there’s also a fragment file reference in the UI as pointed out by the previous post… likely some default change in the UI. The fragment xml defaults seem similar to the activity xml defaults as shown below. Both default files (fragment and activity are as below).

Fragment xml default content

<RelativeLayout 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="com.bignerdranch.android.geoquiz.QuizActivity$PlaceholderFragment" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

Activity xml Default content

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.bignerdranch.android.geoquiz.QuizActivity"
    tools:ignore="MergeRootFrame" />