Image in android? - 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.

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.

Add images from folder in Android Studio?

I have a file with a bunch of images saved on my computer that I need to use for an app I'm creating. I've searched for how to do this, but most everything leads nowhere. The most promising thing I found was to right click, file path, and click the file I need. This worked up until the last step. Here's some screenshots:
-----------------------------------------------------------------------------
I need the "CoolCalc" folder, but when clicked nothing happens. Yes, I've tried restarting. I'm so lost on why nothing's working
1) If you want to just place images as is with no changing size, just move them into the drawable fodler. You can click Show in Explorer.
2) If you want your images to be used as icon of the app or tabs for example, then Android Studio can auto create different sizes for you. Right click on res, pick new and choose Image Asset, then pick image path and give it a name, you can apply some additional changes there.
3) For more sophisticated image addition you can add a plugin such as Android Drawable Importer
https://plugins.jetbrains.com/plugin/7658?pr=
UPD: "File path" just shows you where your folder/file is located. In your case your drawable folder as seen on your screenshot is located at C:\Users(your username not in English language, it seems, that's why it bugged)\AndroidStudioProjects\CoolCalc\app\src\main\res\drawable
If i understood right you have images on a folder and you want to put them in your app right?, Click in Show in Explorer this will open a the Drawable window then you can move the images
or you can move the folder to your assets

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

Android state file does not find dpi dependent drawable

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"

Categories

Resources