I'm getting a RuntimeException when trying to retrieve a Resource
Here is the code that is failing. It is contained in the constructor
of one of my views:
final int vibrateMillis =
this.getResources().getInteger(R.attr.button_vibrate_millis);
Here is the definition of the resource in res/values/attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<attr name="button_vibrate_millis" format="integer">50</attr>
</resources>
Here is the log. I receiove the following warning followed almost
immediately by the stacktrace.
Resource 0x7f010000 is the resource for button_vibrate_millis in the
generated resource file.
I have tried deleting the generated resource file.
And i have tried renaming and relocating the resource.
I plan on switching to using a plain int constant to get around it,
but I can't see why its failing and its bugging me.
Any ideas on why it is failing?
WARN/ResourceType(7773): Requesting resource 0x7f010000 failed because
it is complex
Uncaught handler: thread main exiting due to uncaught exception
java.lang.RuntimeException: Unable to start activity
ComponentInfo{au.com.xandar.jumblee/
au.com.xandar.jumblee.GameScreenActivity}:
android.view.InflateException: Binary XML file line #16: Error
inflating class au.com.xandar.jumblee.widget.LetterLattice
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2496)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #16:
Error inflating class au.com.xandar.jumblee.widget.LetterLattice
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:
565)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:
198)
at android.app.Activity.setContentView(Activity.java:1631)
at
au.com.xandar.jumblee.GameScreenActivity.onCreate(GameScreenActivity.java:
33)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at
au.com.xandar.jumblee.widget.LetterLattice.<init>(LetterLattice.java:
45)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more
Caused by: android.content.res.Resources$NotFoundException: Resource
ID #0x7f010000
at android.content.res.Resources.getValue(Resources.java:891)
at android.content.res.Resources.getInteger(Resources.java:698)
... 26 more
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en