Trouble restoring accidentally moved Android drawable resource folder - android

I accidentally dragged the drawable-hdpi resource folder and moved it under the menu folder. This left me with an empty drawable-hdpi folder with a red x remaining in its place as seen in the screen shot
Performing an Undo Move gave me an error saying the folder already exists in its current location. I cannot drag it back under res as I get a similar error.
I was able to move the contents of the moved drawable folder to the one left in its original place, but the red x on it remains (after refreshing and restarting Eclipse)... which concerns me.
What does the red X mean? (note, this is different than the X you get when there are errors)
Anyone know what I can do to correctly restore the drawable folders?

The simplest thing you can do is.
Browse into the workspace folder to your workspace folder. I mean File Explorer not in Eclipse. Close eclipse by the way. For example, if the workspace is c:\workspace and the project is testproject, you should be browsing c:\workspace\testproject\res\menu\drawable-hdpi
Copy all the contents from here and go back to c:\workspace\testproject\res\drawable-hdpi and paste them here.
Do the same with the drawable-ldpi folder. Copy contents from the folder under menu and put it in the res\drawable-ldpi.
Manually delete the drawable folders from the ones in the menu folder.
Start eclipse. Select your Project and press the F5 or Right Click on the project and select Refresh.
If you are still left with errors, go to Project Menu - > Clean.
Let me know how things go.

Related

How to see a preview of custom vector asset (added by SVG format) in Android Studio?

I know i can use my own svg as icons by browsing them from the asset studio but it just show the name not the exact icon of the svg, i can't know just by name what that icon is look like , so can i view them while adding them to project like they are showing in below image?
I have many icon on my computer can i add them to that list , so that i can see them visually when i want to add a new vector asset.
I tend to think that it can be done because then icons which android asset studio is shows must be stored in a directory from where it pulls when when i open asset stdio , if i can add my svg to that directory then android studio may may also pull them too with default clip arts and they may also show up in asset studio, does anyone know what that directory is , or any other way of doing this.
Note android studio does not give such option via UI
When you add a new vector asset (assuming you've added it in the drawable directory), it gets added in the drawable directory.
It is generally saved by the name ic_thatSVGname. So it gets the prefix IC. So please browse in the drawable directory and you will find your vector asset.
Then double click on it so that it opens and you can see the preview on right side of the screen. It it doesn't, just click the PREVIEW button which also reside on the right side of the Android Studio.
So that means just search for that in drawable directory. And while adding new vector assets, right click on the DRAWABLE DIRECTORY only so that it gets into that directory else it might end up outside it.

How to move all the density versions of resource in one command?

I've got many image resources in several densities, and I'd like to move them into an other module. Moving them one by one takes a long time, especially because Android Studio's Project window goes into some kind of flickering on every file move.
For exemple, I'd like to move the following resources:
module1/src/main/res/drawable-hdpi/image_a.png
module1/src/main/res/drawable-mdpi/image_a.png
module1/src/main/res/drawable-xdpi/image_a.png
module1/src/main/res/drawable-xxhdpi/image_a.png
into
module2/src/main/res/drawable-hdpi/image_a.png
module2/src/main/res/drawable-mdpi/image_a.png
module2/src/main/res/drawable-xdpi/image_a.png
module2/src/main/res/drawable-xxhdpi/image_a.png
Is it possible to move the four files in one go, instead of having to do a Move... on each file ?
I propose this solution.
In module2 project, right click the res folde, then select the New > Image Asset menu.
Then, in the Configure Image Asset window, select the right Icon Type and , in the source asset section, select Image as Asset Type and enter the path to the xxhdpi version of the image from module1. You may need to pay attention to the other fields before clicking the Next button.
This will automatically generate all the image resources.

How to create drawable folder in res?

I am trying to create drawable-hdpi drawable-xxhdpi drawable-ldpifolders for different screens but unable to create as it says the folders already exist but i can't see them also when trying to create drawable-xxhdpi folder on click nothing happens no folder's are create
Screenshots below
Can't see any drawable-xhdpi folder although it says it exist
Here on clicking OK nothing happens no folder is created
Yes it already exist.
you have to change the project structure
Click on top left dropdown where Android Appears.
Select project from this dropdown and you will be able to see all drawbale folders.
Its because you might not have any files inside your res/drawable-xxx folders
To access them, change your project navigation:
To do so, check the top left pane for some written as 1 Project click on that or alternatively press Alt+1 here, if you see the default selection will be Android with an android bot click on the two left-right arrow icons select Project Files and then navigate!
You do not need to explicitly create the drawable folders for different resolutions.
Whenever you will add any image to the project's drawable folder, by clicking right on the drawable folder and pasting the image there, a dialog will open up, that will ask you to select from drawable-hdpi, drawable-mdpi, drawable-xhdpi, and drawable-xxhdpi.
You can then select the suitable one from the drop down, and you will be able to see the distinctions within the drawable folder itself.

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

Android Studio automatic created Image Asset in folder midmap-xxxhdpi but name of icon appears in red (= error/not added?)

I just added my first icon for my app to my project. I did it by right clicking on the res folder and then selecting the option Image Asset which lets you create an icon on different resolutions and automatically adds them to the appropriate mipmap-folders.
Now I get the name of the image displayed in red in the folder midmap-xxxhdpi, maybe it's also useful to say that I got VCS running. I got no problems with all the other images in the different folders under res. What is causing the text to be displayed in red?
ps: also the ic_launcher-web.png is displayed in red.
"-" is not a valid resource name character
remove "-" from the pic name, and clean your project.

Categories

Resources