Android state file does not find dpi dependent drawable - android

I have a state file for buttons which worked fine until I put drawables into res/drawable-mdpi.
I had only drawable in res/drawable-hdpi but I want the app to work on all displays.
The state file is placed in res/drawable as I read it on some websites.
That way it is also done by google with the standard drawables but Ecplise keeps telling me that it can't find drawable with value #drawable/button_normal.
The drawables are definitely at their places.
So what am I doing wrong here?

Ok...there was nothing wrong with the code, drawables were not ok.
I made them again, 9-patched them and voilĂ : no comments by eclipse.
Sorry for wasting place for this.

make a folder drawable inside res and put ya pics into that folder. and you can refer to them as
android:background="#drawable/oscar"

Related

Android Studio: Is is possible to set default drawable folder?

I am having a rather annoying scenario where I work with a lot of drawable shapes, many of which are slightly changed variants of others. The annoying thing is, when I paste the drawable, it automatically defaults to a random resource folder. See bellow photo. I want it to go directly to the standard drawable folder, not some other density drawable folders without having to manually change the folder every single time.
Is this even possible?
You can change the View from Android to Project if you are copying & pasting multiple images in a row. You can simply paste it to the drawable folder.

Image in android?

My ImageButton in my app is very tiny and cut off. I realized this could be because the image was in the drawable folder instead of the mitmap folders. So, I copied the images from the drawable folder, and pasted them in mitmap folders. Now, should I go about deleting the image from the drawable folder? I get the following saying it is not safe:
I know how to access the images, but should I delete them from the drawable folder now that I have already moved them to the mitmaps? If I do a delete anyway, will I need to alter my code to access the mitmap image? What is safest to do?
Here is an image of my mitmaps:
Thanks for the expert advice,
Rich
"Not safe" in this context just means that it's still being used somewhere. If you delete it, the current usage will fail to compile, and you'll be easily able to find and alter it to point at the new location.
You can safely delete this image, in Android Studio if you are using this image or else the file will be open at some place, you can get this error actually, so try deleting this image will safely remove the only selected image into your workspace. So hassle free to delete it.
After deleting your image, clear your project and run it, it works fine.
The mipmap folder is used for image that are very small and should be used in the action bar, and other menus. If you find your image too tiny, it just will be worst if you put it in the mipmap folder. If it's tiny although the image is in the drawable folder, maybe the image has a very small dimension or your imageview is too small.

Cannot change the image background in android using eclipse

I have a problem in changing the image background in Android using Eclipse.. I already replaced the previous image but then when the emulator run it always appears the replaced image.Pls help to solve this.Thanks
So what you are saying is that even after you replaced the images those images are still shown. Make sure that you replaced the previous images in all of the drawable folders. Because if you just replaced the drawable-hdi images but not the drawable-mdpi ones than if the emulator or device has a mdpi screen it will load the mdpi images from the drawable-mdpi folder thus showing the older images. So make sure you replaced all the images and not just in one folder.
Simply add android:background="#drawable/backgroundmenu" in your Layout section in XML activity
But first, import an image called "backgroundmenu" in drawable.
you need to clear your files in drawble folder in this location; ..\eclipse\workspaces\YourProjectName\bin\res\crunch\drawable
clear all files there, good luck!

How to get images(same name) from different drawable folder in a android project?

I need to get same images with same name, but in different resolution. So i created different drawable folder for every resolution and having images with same name in all folder. But when i am running this aap at that time some images coming dynamically at diff resolution. I have to bound images, should comes from related resolution folder at which device it is running at that moment. I used some images as theme, these are making trouble for me. :( :(
I created drawable folder in this way.
drawable-sw600dp-land-mdpi.
drawable-sw600dp-port-mdpi.
Please help me, I am indeed.
If your folders are named correctly, android will take care of that by hisself. If the device is rotated, the activity is destroyed and recreated again. Depending on on current state (landscape or portrait), android loads the drawable from the corresponding folder and you only have to say "load a drawable" :)
If the corresponding folder doesnt exist, android falls back to a default one.
Try to change
"drawable-sw600dp-land-mdpi" to "drawable-sw600dp-land"
"drawable-sw600dp-port-mdpi" to "drawable-sw600dp-port".
Remove "mdpi" from directory names.
create drawable folder like this
drwable-land-mdpi
drawable-port-mdpi
drwable-land-hdpi
drawable-port-hdpi
and also see this link google resources

What is a Drawable?

I'm new in Android dev and I have a ridiculous question..
I read this Drawable but I didn't understand everything (because I speak french, not english).
Well.. can anyone explain me with simply words what is a Drawable?
Thank you, best regards.
Drwable are something that can be drawn on screen for examples images that are drawn on screen.
See this location res/drawable-hdpi or res/drawable-mdpi or res/drawable-ldpi in your project folder , they all are some types of drawables location where we keep our drawables .
Basically any object that is able to be drawn to the screen

Categories

Resources