3 Replies - 1197 Views - Last Post: 26 April 2012 - 04:33 PM

#1 thedarkcheese  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-May 11

Cannot Save ID to Resource File in Android Application Project

Posted 20 April 2012 - 01:56 PM

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>

</LinearLayout>

None of theses IDs will register within the resource file.

Is This A Good Question/Topic? 0
  • +

Replies To: Cannot Save ID to Resource File in Android Application Project

#2 slehmann101  Icon User is offline

  • D.I.C Head

Reputation: 21
  • View blog
  • Posts: 146
  • Joined: 30-November 11

Re: Cannot Save ID to Resource File in Android Application Project

Posted 20 April 2012 - 03:47 PM

go project>clean

Check that all of your xml files and resources ie images, videos etc. have no capitals in the title.

If that doesn't work you can delete the R file, and then go project>clean

This post has been edited by slehmann101: 20 April 2012 - 03:50 PM

Was This Post Helpful? 1
  • +
  • -

#3 thedarkcheese  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-May 11

Re: Cannot Save ID to Resource File in Android Application Project

Posted 26 April 2012 - 02:18 PM

View Postslehmann101, on 20 April 2012 - 03:47 PM, said:

go project>clean

Check that all of your xml files and resources ie images, videos etc. have no capitals in the title.

If that doesn't work you can delete the R file, and then go project>clean


After cleaning the project, the errors on the XML file have disappeared. However, the R file is gone, and the files still are not referencing the IDs set up the XML files. Can you help?
Was This Post Helpful? 0
  • +
  • -

#4 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 193
  • View blog
  • Posts: 1,099
  • Joined: 13-March 09

Re: Cannot Save ID to Resource File in Android Application Project

Posted 26 April 2012 - 04:33 PM

Just create a new class-file in gen -> *package name* and name it "R"
Then try to rebuild it again.
Sometimes you have to do this several times.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1