Skip to main content

Posts

Showing posts with the label Android Studio

How to Register New File Type Association with MP3 in Android Studio

While working with mp3 file in your res\raw when Run the app (Shift+F10) android studio will ask for New File Type Association. There are two ways to handle this: First: Check the option "Open matching files in associated application" and click OK. Second: You can add manually and also remove the file association (If you have previously incorrectly associated "*.mp3" with something else, then Android Studio warns you and allows you to delete the old association). Select File -> Settings (Ctrl+Alt+S) -> File Types -> Files Opened In Associated Applications Click on the + sign Add "*.mp3" Click OK. Note: Resource names must contain lowercase a-z, 0-9 or underscores.

How to add an image to the "drawable" folder in Android Studio

There are 3 easy ways for importing the image file in Drawable directory of Android Studio. One important thing to remember image file name should be start with text. First: In Project file find the directory "res" than "drawable".  Right click on "drawable" directory and from menu click on "Show in Explorer". drawable folder will be open in windows' explorer. Copy paste the images here. Go back to Android Studio, images will be available in "drawable". Second: Select the image from explorer and drag to drawable in Android Studio. (Note: this will move the actual file) Android Studio will open a dialog for asking directory path. Click OK button. Third: In Android Studio go to the activity.xml design screen and from "Palette" drag drop the "ImageView" in "Component Tree. From "Attributes" window find "srcCompat" and click on option button. A window will open. Click on "+" and cho...