Reputation: 55
I get the following logcat when i try to show an alertdialog:
01-04 10:14:06.440: ERROR/AndroidRuntime(5993): FATAL EXCEPTION: main android.content.res.Resources$NotFoundException: File res/drawable-mdpi/dialog_top_holo_dark.9.png from drawable resource ID #0x108022c at android.content.res.Resources.loadDrawable(Resources.java:1942) at android.content.res.Resources.getDrawable(Resources.java:664) at android.view.View.setBackgroundResource(View.java:11695) at com.android.internal.app.AlertController.setBackground(AlertController.java:659) at com.android.internal.app.AlertController.setupView(AlertController.java:429) at com.android.internal.app.AlertController.installContent(AlertController.java:241) at android.app.AlertDialog.onCreate(AlertDialog.java:336) at android.app.Dialog.dispatchOnCreate(Dialog.java:353) at android.app.Dialog.show(Dialog.java:257) at android.app.AlertDialog$Builder.show(AlertDialog.java:932) at com.sms.MyActivity$3.onClick(MyActivity.java:180) at android.view.View.performClick(View.java:3511) at android.view.View$PerformClick.run(View.java:14105) at android.os.Handler.handleCallback(Handler.java:605) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.io.FileNotFoundException: res/drawable-mdpi/dialog_top_holo_dark.9.png at android.content.res.AssetManager.openNonAssetNative(Native Method) at android.content.res.AssetManager.openNonAsset(AssetManager.java:407) at android.content.res.Resources.loadDrawable(Resources.java:1934) ... 21 more
Can anyone point me in the right direction, so far googling has proved fruitless..
Upvotes: 0
Views: 642
Reputation: 13015
The key here is the line: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/dialog_top_holo_dark.9.png from drawable resource ID #0x108022c1
. This means that the runtime compiler cannot find the appropriate file dialog_top_holo_dark.9.png
.
Now, it is looking in your /res/drawable-mdpi/
folder. If it is not defaulting back to res/drawable/
, that means that often there is afile of that name detected, but there is an error reading the file. This means you need to do these things, in this order.
First, make sure you have a file name dialog_top_holo_dark.9.png
in your drawable folders.
Second, make sure that the file ends with the .9.png
extension.
If the file does exist, but has a red X marking an error: Open the file in your graphics editor and resave the file with the same name.
If this does not get rid of the red X, clean your project. In eclipse, this is done by clicking Project -> Clean in the menu.
If this still does not resolve the issue, you may have to remake the file by scratch.
This sometimes happens if you import a .png
or .9.png
from the file system or from another project. Eclipse and the Android SDK does not always grab and copy the file properly. I've had this happen with a number of graphics files. As long as I follow the steps above, the problem becomes resolved permanently for that file in that project.
Hope this helps,
FuzzicalLogic
Upvotes: 1
Reputation: 1627
you just need to check the logs properly, it is clearly saying that it is not able to locate dialog_top_holo_dark.9.png, did you put that file in proper resource folder.
And one more thing, if you had put the file at correct location, just give the clean build, sometimes changes doesn't reflect, so its better to give clean build.
Upvotes: 0