How can I change the default preview device in Android Studio? - android-studio

When I'm creating a new project, the default preview device appears as Nexus 4. Is there a way to change it to some other device?

Recently I had the same issue.
It seems that you cannot use a device from the "virtual device" category. That way only the selected layout will be shown inside the chosen device.
In order to change the default device for all layouts you have to choose from some of the other categories (the ones inside the red rectangle):
I have chosen "6.0 1440 x 2560" from "Phone" and all my other layouts changed to this device (before I was selecting "Nexus6_API_29_Android" which was my virtual device, and I had to change it on every layout manually)

Same issue was appearing for me, when I was selecting device for preview from 'Virtual Device'.
To select device which will be default for preview when opening activities choose from these in picture, which are marked in red rectangles.

Change the preview device>>for example: nexus5x or others.
File--Export Setting, then choose a dictionary to save it. For example, I save it on my desktop, next you will see a settings.jar on your desktop.
File-Import Setting, choose the settings.jar.
Android Studio will want to restart itself, click OK
My English is very poor. I'm so sorry.
Maybe it works well. I'm not sure. You can try it.

The top answer covers most cases.
But if you want to use a custom made device you can also click on the Generic Phones and Tablets option, and choose your device from there.

You just need to follow few steps to do this
Step One
Open Any layout file from
App >> res >> layout directory
Step Two
go to the above red marking option
Then you will find the available devices for change
N.B. I am using Android Studio 3.6.2

Go to Run -> Edit Configurations. "Under Deployment Target Options", de-select "Use same device for future launches."
To prevent the same device from being used on subsequent previews, when you create a new project and run it in the AVD, do not select "use the same device."

Related

Hide taskbar on then second monitor when using fullscreen in Android Studio

As I said in the title, when I enter full-screen mode in Android Studio (or other JetBrains IDEs) the taskbar on the second monitor will be shown while in the main monitor it will hide.
How can I get the same behavior on the second monitor? I'm using Windows 10.
If I'm getting you correctly .. and after checking linked tickets on JetBrains Issue Tracker ... it's not possible:
IDEA-129034 and perhaps IDEA-164559-- watch these tickets (star/vote/comment) to get notified on any progress. Right now it does not look like these tickets are on devs "to do soon" list.

Screenshot And video option is missing in Android Studio 3.4.1?

Android studio missing take screenshot and video option is missing in latest version(3.4.1).
Ctrl+s is working but i am unable to get screenshot in real device(attached via cable) use Ctrl+s.
Any other way to taking the screenshot of real device and store in to system?
Click on setting icon on top and click "Show Toolbar" like in below pic
You can take photos/videos under Logcat, using these buttons. Sometimes they are hidden in a little drop down, which is indicated by two little arrows instead.
Unless you mean taking screenshots and saving them on the device. In which case just use the device's mechanism for taking screenshots?

Can't see preview of android studio

I recently installed android studio but can't see the preview of the app.
When you switch in the Layout.xml, on the bottom you will see two options: -Design -Text. Chose Text and then on the top right you will see Preview appears and so you can click Preview.
Go to Res->values->styles and change the name of your theme to base.theme. ex-> Theme.AppCompat.Light.DarkActionBar to Base.Theme.AppCompat.Light.DarkActionBar
Please notice the value on the right of the small android icon, just above where the "preview" should be.
There you should pick the API in wish the representation is made. If theres nothing to select there, you will need to install the necessary API packages.

Android Studio Resetting Changes to Default Code Style

I'm here today because I'm having an issue with Android Studio. I don't know if it existed on previous versions (I don't remember this being an issue, so I doubt it was a problem on a previous version), but currently I am using the Android Studio V2.1 Stable release.
My issue is that if I launch Android Studio (I happen to be on Windows, 64-bit Android Studio) and at the Start Screen/Page, I click Configure>Settings>Editor>Code Styles, and change the default parameters on any of the languages (XML, Java, HTML, etc.), the Default profile is copied to a new profile (Default(1)) and the new settings get applied to each profile.
If I Apply these changes and exit Android Studio, and launch back up and follow the same method...the settings have completely gone back to what they were before I changed them, with the exception of the Default(1) copy profile. But from my experience, Android Studio doesn't build new projects based on this Default(1) copy profile, it builds them on the Default profile. Which means all of my adjustments to using indents and not spaces, keeping indents on empty lines, etc. all do not get carried through to the actual project files, leaving me to have to go back into the settings with the project loaded up and change all of these parameters again. That's just asinine. Please tell me I'm missing something here and that there's a simpler way of achieving the ability to keep a code style template that I can use on all of my projects!
Perhaps it would be better to report or consult on this using the Android Studio feedback site. If that's the better option, I'm willing to do that too.
Thanks everyone!
What I do in that case is
Go to Preferences
Code Style
Select scheme you want
Click Settings cog
Click copy to project
Some OKs and then it works.
After selecting the code style that i want, opened the gradle.properties file in root folder of the project and deleted the following line
kotlin.code.style=official
deleting the above line, prevents the code style resetting to default.
Go to Preferences
Code Style
Set Scheme to Default [IDE]
Click restore defaults
The simplest way I found to reset the default settings is as follows:
In Android Studio, click on File.
Settings (Ctrl + Alt + S)
Under Editor in settings
Select Code Style
Next to Scheme: select the three dots to access the scheme options ()
Select Restore Defaults
A Confirmation Dialog Box will be displayed to confirm if you want to revert back to
the default settings.

Android : cannot input text from keyboard

When my android sdk update to newest version, i met the issue is : I cannot type text into Android Emulator by using computer keyboard, and I cannot use Android Emulator keyboard (the keyboard that next to the screen).
If I want to input some text, I must use this : click to textfield where I want to type. It will go to screen with virtual keyboard (as a real mobile phone), and click the character I want.
This annoy me because make me slower when debug an app. Please help me, how to type directly using keyboard.
Thanks :)
Add "Keyboard support" to your emulator hardware:
On Eclipse, go to Window > AVD Manager
Choose your emulator > Edit
Click "New" button in "Hardware" section
Select "Keyboard support" and change value to "Yes"
Finally, click on "Edit AVD" button.
Then you could input text to your emulator from your keyboard.
FYI - since I upgraded to sdk v14, I've had settings issues on the emulators. Leap's solution does work, but you might have to start and stop the emulator several times before these settings stick. No idea why that is ...

Resources