How to add color schemes to Android Studio? - android-studio

I found some links to download the .icls files on the link below. However, just by adding the .icls files to the color folder is not doing the job.
Any pointers in right direction is appreciated. (I found only one dark theme here and looking for light themes).
How to change or add theme to Android Studio?

Found the issue: I was using firefox to download from the site and the site below was giving me a .zip file instead of .jar file. Used Chrome and got the .jar file. [Editor's note: the site previously linked here has changed owners and been replaced with spam, and has been edited out]
Steps to follow:
File > Import Settings. Select the .jar file.
Close and start Android studio (auto restart didn't work)
Settings > Editor > Colors and Fonts select your theme and you are good to go.

Related

Android Studio on Ubuntu 18.04: No Fragments Found... How do I "create one or more Fragments in code"?

Scenario
I'm starting to learn Android Development on my Ubuntu laptop, but having issues with creating layouts with fragments.
Steps Taken
I created a new project with an Empty Activity
I right-clicked my app folder and performed: New > Fragment > Fragment (Blank),
Named it TestingFragment
Unchecked "Include fragment factory methods?"
Unchecked "Include interface callbacks?"
Under res > layout I updated the fragment (fragment_testing) to recognize it within the main activity
I went to the activity_main.xml file, added the FrameLayout to the layout
I tried to drag the < fragment > component to the FrameLayout
I receive an error message with just an OK button:
No Fragments Found
You must first create one or more Fragments in code.
My Best Guess
It appears that my Android studio is not recognizing that I have the fragment code created and just need to add it to the layout.
Perhaps I need to configure the Gradle scripts to be able to find the TestingFragment class?
What I've Tried from Googling Around
I have installed, uninstalled and re-installed Android Studio using Snapcraft
I have installed, uninstalled and re-installed Android Studio using android-studio-ide-191.5791312-linux.tar.gz from the official Android Download site within the /opt directory.
I have made sure all plugins are checked via File > Settings > Plugins
I have verified that my Android SDK Location is pointing to the right folder via Tools > SDK Manager.
Under SDK Platforms the following SDKs are installed and checked:
Android 10.0 (Q)
Android 7.1.1 (Nougat)
Android 7.0 (Nougat)
I have tried the File > Invalidate Caches / Restart... option choosing the Invalidate and Restart button
I have tried the File > Sync Project with Gradle Files option.
I have tried the File > Sync with File System option
Edit:
I have been able to go into the xml of the main_activity layout file and add a fragment tag manually and found that it can work. The following is the manual tag I managed to add:
<fragment
android:id="#+id/fragment"
android:name="android.example.testfragments.ListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="#layout/fragment_list" />
Still working on fixing the drag-drop "No fragments found" issue.
Where to go from here?
Does anyone know where I can go from here other than virtualizing another OS like Windows to see if it works there?
Solution
So after hours of poking around the settings and googling around, I discovered the reason why it wasn't working by accident.
While creating a new project, the application's Package name field cannot follow the "android.example.packageName" pattern.
After being unsuccessful for so long, I decided to try a new project and change all the options to completely start anew from scratch. During the process, I changed the package name to "com.frags.testing".
I then proceeded with the steps described above to make a fragment and I was successfully able to add the fragment using the drag-drop method into the main_activity layout.
I also verified that this worked by going back to my previous project where it wasn't working and creating a new package named fragments and refactored the fragment class to that new package. I then went back to the main_activity layout and dragged the < fragment > component to the layout and it successfully found the fragment.
Hope this helps someone else out there.
Cheers,
Justin

Android Studio. How export Live Template to file?

Android Studio 2.3.2.
I want to export Live Templates-->AndroidLog to file.
How I can do this?
Thanks.
IntelliJ IDEA (and Android Studio) stores definitions of custom live templatein automatically generated configuration files <group_name>.xml.
Depending on the operating system you are using, the <group_name>.xml files are stored at the following locations:
Windows: <your_user_home_directory>\.AndroidStudio<version_number>\config\templates
Linux: ~/.AndroidStudio<version>/config/templates
macOS: ~/Library/Preferences/AndroidStudio<version>/templates
Now you can share the templates among your teammates, send the relevant files to them with the instruction to save the files in the templates folder
Or You can sharing live templates through export/import
Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for macOS, and click Live Templates under Editor.
On the main menu, choose File | export Settings.
In the Export Settings dialog box that opens, select the Live Template check box and specify the name of the .jar file where the exported settings will be stored. When you click OK, IntelliJ IDEA generates a file with the specified named based on the .xml configuration files stored in the templates folder.
To share the templates among your teammates, pass the generated .jar file to them with the following instructions:
Save the received .jar file on your computer.
Choose File | Import Settings on the main menu and and specify the location of the received .jar file.
In the Select Components to Import dialog box that opens, select the Live Templates check box and click OK.
For any other information, here the official IntelliJ guide
Updated >Android 4.1
IDE configuration directory changes The locations of user
configuration directories have been changed to the following:
Windows Syntax: %APPDATA%\Google<product>
Example: C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio4.1
macOS Syntax: ~/Library/Application Support/Google/
Example: ~/Library/Application Support/Google/AndroidStudio4.1
Linux Syntax: ~/.config/Google/
Example: ~/.config/Google/AndroidStudio4.1
C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudio4.1\templates
For Mac:
Android 4.1
/Users/{User Name}/Library/Application Support/Google/AndroidStudio4.1/templates

Show all drawable content in Android Studio

In my project I have got a lot of drawable content, and when I need to add new images to drawable I can put a same resource because I forget I have it already.
It is not about preview on XML file, this works well.
Any features in Android Studio to preview all my drawable contents without double-click on every resource? It can save lots of time.
I didn't find anything at Preferences, maybe some plugin or did I miss something?
Starting from Android Studio 3.4, you can use Resource Manager, a new tool window for importing, creating, managing, and applying resources to your app's layouts. You can open the tool window by selecting
View > Tool Windows > Resource Manager from the menu bar.
Right click on drawable folder and click 'Show Image Thumbnails'.
I'm using Android Drawable Viewer that can be installed from Plugins in AndroidStudio. After installing and restarting Android Studio, you will find a tab on the right side of the editor where you can find the viewer.
Click on that tab and you'll be asked to select the root folder for drawables. Do it, and after, everything will look like this:
Consider using Android Drawable Preview plugin. It shows content of the images instead of default icons when you expand drawables.
It even renders vector xml drawables!
Like this:
To install it: go to File > Settings > Plugins > search for Android Drawable Preview and click to find in repos. Install it and restart Android Studio.
Cheers!
Note/ when using 'Show Image Thumbnails' (as #Akhil Tawari suggested) in "Android" view as opposed to "Project" view, for image thumbnails of all drawables right click the "res" folder and not the drawables folder/s.
You can right click on the folder and click open in files. This will allow you to open up the project folder in which you can more easily add and delete images and other files.

How to save and restore Android Studio user interface settings?

Android Studio allows the user to customize certain features, such as editor settings and coding styles. On Windows boxes, the default folder for these settings appears to be C:\Users\{username}\.AndroidStudio{version}\config. I'm looking for documentation for these files so that we can decide which files should be under version control.
The goals are: 1) to have consistent UI settings for a group of developers; and 2) to have an easy way to configure a new Android Studio install.
So far, the following files look interesting:
...\config\templates\user.xml User-defined code templates
...\config\options\editor.codeinsight.xml Editor settings & code insight
...\config\options\editor.xml Editor settings
...\config\options\cachedDictionary.xml User additions to spelling dictionary.
...\config\codestyles\Default_1_.xml Code formatting
You can go file > Export settings then you get to choose exactly the settings to export and you get a single settings.jar file.
The reverse process is file > Import Settings > choose settings.jar
It seems that the user interface has changed since the last answer.
Now as of Android Studio 4.2 Bata 1 on Windows
You have to go to File -> Manage IDE Settings -> Export Setting to see the same window.
If you can't find the File > Import Settings menu, try accessing File -> Manage IDE Settings -> Export Setting.
There may be differences on the version or operating system.
On Android Studio 3 on Mac, it was configure > Export settings, resulting in a settings.zip file.
Because this is so badly implemented, in case you selected some custom folder and now the export button is disabled: you also need to manually specify a _name_.zip, the Android Studio is incapable of doing it itself, ex: x:\settings.zip
It might be obvious, but it did gave me a small headache this morning.

How do I add folders into the Solution Explorer for Visual Studio Express 2012 for Web?

I am very new to Visual studio, so I am trying to learn the basics.
I have read so many articles but some are for 2012, some are for the non-web version, etc, but I seriously can't find a solution to such a simple task as this.
I am using Visual Studio Express 2012 for Web, and have created a "Blank Solution".
I end up with this view:
Now my goal is to add all my existing files and folders and have it shown in Visual Studio.
So, I have located my solution file on disk and copied all my files into the same folder:
Now, I know its possible to add single items into the view by right clicking and picking add item:
But I cant include folders here. I have tried to drag and drop, I have read guides about using the "Show all files" button, but apparently that does not exist for the Web version of Visual Studio 2012.
Could anyone please tell me what the proper way is to include all my files into the solution explorer?
I just had this same problem in Visual Studio 2012 Ultimate. I know your question is about Web but maybe this will work for you too.
Assuming the files/folders you want to include are in your solution folder, from the Project menu toggle on "Show All Files", then you should see the files/folders in Solution Explorer. Select those you want to include, right click and choose "Include in Project".
A solution contains one or several projects and no solution-wide files (normally). Create a project, and then follow How do I add an existing directory tree to a project in Visual Studio? to add the files.
(It was a long time ago I did it this way, and with an earlier version of Visual Studio, so YMMV.)
I think that the best way to do it is to simply drag&drop desired folders with files between file explorer and solution explorer in VS. I've just tested it and that works the best for me.
You can place your files in the Solution folder and refresh the solution explorer :) It'll automatically add your files, I do it for 2010 and think it'll work for 2012 as well
In solution Explorer top toggle,You can find few icons, Find Show all files and click on it.Navigate to the folder exactly matching the same address in your visual studio and you can see a folder which is newly added into your project,Which is displayed as a dotted folder and right click on it and include it into project.
Don't forget to convert the project into Web-Application.
Thanks.
I actually found the solution.
So in solution explorer there is a button "Solutions and Folders" screenshot
When you pressed it your project folder would be opened. You find the folder that you need to add, copy it (screenshot), return to project solution and past it

Resources