When trying to add a custom image to a ImageButton, I get the following error:
E/AndroidRuntime(3304): Caused by: java.io.FileNotFoundException: res/drawable/btn_default.xml
This Works:
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/btn_plus" />
This does not:
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/elec" />
On the designer I can see the image fine on the button, but as soon as I try to run it, I get the above error. The elec.png file is in drawable-hdpi.
Burned 3 hours trying to find the problem. Any help really appreciated!
In the end, it turned out that my emulator was somehow corrupted. The code works perfectly on a real device and on a newly generated emulator.