tags:

views:

108

answers:

1

Hi,

In my android application, I would like to support multiple screens. So I have my layout xml files in res/layout (the layout are the same across different screen resolution). And I place my high-resolution asserts in res/drawable-hdpi

In my layout xml, I have

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/table"
    android:background="@drawable/bkg">

And I have put bkg.png in res/drawable-hdpi

And I have started my emulator with WVGA-800 as avd. But my application crashes:

    E/AndroidRuntime(  347): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020023 a=-1 r=0x7f020023}
E/AndroidRuntime(  347):        at android.content.res.Resources.loadDrawable(Resources.java:1677)
E/AndroidRuntime(  347):        at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
E/AndroidRuntime(  347):        at android.view.View.<init>(View.java:1850)
E/AndroidRuntime(  347):        at android.view.View.<init>(View.java:1799)
E/AndroidRuntime(  347):        at android.view.ViewGroup.<init>(ViewGroup.java:284)
E/AndroidRuntime(  347):        at android.widget.LinearLayout.<init>(LinearLayout.java:92)
E/AndroidRuntime(  347):        ... 42 more

Does anyone know how to fix my problem?

Thank you.

A: 

If you are using Eclipse, do a force-clean of the project or otherwise get rid of what's in your gen/ directory. If you are using Ant, run ant clean. Then, try a rebuild and see if that helps.

CommonsWare
No. But if i put image in drawable-long. It works. I am not sure what does drawable-long different from drawable-hdpi
michael
`-long` is for "long" variants of screen sizes. WVGA800 is `-notlong`. WVGA854 is `-long`.
CommonsWare