Chad White
Chad White

Reputation: 309

android.view.InflateException: Binary XML file line #1: Error inflating class <unknown> background pic

I have a activity with a Background Image - now I would like to Change it and copied the new one in the drawable-hdmi Folder - rename it to Background an have deleted the old one in the Folder

but now I can put None Picture as Background - every time appears above mentioned error

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background"
>

What can I do - have cleaned it already

02-11 21:58:33.653  10226-10226/de.tetzisoft.virjouthrger E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{de.tetzisoft.virjouthrger/de.tetzisoft.virjouthrger.ICit_A}: android.view.InflateException: Binary XML file line #1: Error inflating class 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
            at android.app.ActivityThread.access$600(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:4787)
            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:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class 
            at android.view.LayoutInflater.createView(LayoutInflater.java:613)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
            at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
            at de.tetzisoft.virjouthrger.ICit_A.onCreate(ICit_A.java:16)

So say Android Studio

Upvotes: 1

Views: 7518

Answers (2)

Elyakim Levi
Elyakim Levi

Reputation: 370

1) Make sure you name your resource "background" and not "Background". It's case-sensitive.

2) If you changed the resource using Windows Explorer and not Android Studio, refresh the project to update the resources.

3) You spelled your drawable folder like this "drawable-hdmi". It should be "drawable-hdpi".

4) Put the resource in "drawable" (default folder) just in case your device's density is mdpi or lower.

Upvotes: 2

Matt Boyle
Matt Boyle

Reputation: 385

Have you tried naming it something else? Also even though you refer to it as background, have you made sure it keeps its .png extension?

Try cleaning and rebuilding your project,invalidate caches and restart.

Finally, open the folder for your app in finder and assure that background.png is in there.

Upvotes: 0

Related Questions