Reputation: 1
I have been working on an Android Application project recently, and I've notice that some of my code IDs within a XML file will not register within the R file, and I have not been able to access the IDs within my classes. The code within the XML file will look like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView android:layout_height="250dp"
android:layout_gravity="center"
android:src="@drawable/icon"
android:id="@+id/ivReturnedPic"
android:layout_width="250dp"></ImageView>
<ImageButton android:layout_height="wrap_content"
android:src="@drawable/icon"
android:id="@+id/ibTakePic"
android:layout_width="125dp"
android:layout_gravity="center"></ImageButton>
<Button android:text="Set Wallpaper"
android:id="@+id/bSetWall"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_gravity="center"></Button>
</LinearLayout>
None of theses IDs will register within the resource file.
Upvotes: 0
Views: 44
Reputation: 126445
you must be sure that the image "icon.png" or "icon.jpg" is under your res/drawable folder.
android:src="@drawable/icon"
Upvotes: 0
Reputation: 68167
There's problem in your xml that's why R is not being generated automatically
Remove one of extra </LinearLayout>
Upvotes: 1