Monday, May 20, 2013

[android-developers] Another Resources.NotFoundException with setContentView()

There are lots of Resources$NotFoundException questions on the web and I've reviewed them and tried the various suggestions to no avail.

I had a perfectly working layout to display some graphics with some buttons underneath and I modified some of the buttons and started to get this error. I couldn't see anything wrong with my changes but just to narrow it down I deleted ALL the buttons, so now I just have a LinearLayout with an ImageView and I'm still getting the error. My Java:

    try  {          setContentView(R.layout.graphics);      }      catch (Exception e)  {          Log.d("DGraphActivity", "setContentView crash");         }

My XML:

<?xml version="1.0" encoding="UTF-8"?>  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:orientation="horizontal">     <ImageView         android:id="@+id/image2"        android:layout_width="0px"        android:layout_weight="2"        android:layout_height="match_parent"        android:scaleType="fitCenter">      </ImageView>   </LinearLayout>

The error says android.content.res.Resources$NotFoundException: Resource ID #0x7f030005. In the R.java file that resource is identified with the graphics . . .

public static final class layout {          public static final int addcomment=0x7f030000;          public static final int areyousure=0x7f030001;          public static final int downarrow=0x7f030002;          public static final int downleftarrow=0x7f030003;          public static final int downrightarrow=0x7f030004;          public static final int graphics=0x7f030005;          public static final int infofromoperator=0x7f030006;

I deleted the gen folder and did a clean of the project with no improvement.

I also rebooted my PC and did an explicit close of the project.

I did a Refresh of my project

I do not have an explicit import Android.R

There's nothing obviously wrong with the graphics.xml file - it exists in the same folder with all my other XML files; it's not write-protected or hidden. Eclipse doesn't flag any errors or warnings for it.

Thanks in advance.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment