android-studio

Report unused imports as error in Android Studio or IntelliJ

天大地大妈咪最大 提交于 2021-01-28 20:29:40
问题 Is there any way/setting in Android Studio to report the unused imports in java files as error? In Eclipse, lint reported this as error pretty easily. 回答1: Applies to Android Studio and IntelliJ You could go to File/Settings then browse to Editor/Inspections/Import. Change Severity of Unused Import to Error 回答2: try this. its automatically remove unused imports yourProject --> Right Click --> Optimize Imports lint : its also show unused imports in java files as error yourProject --> Right

Play Store support for Android TV on Android Studio

萝らか妹 提交于 2021-01-28 20:07:23
问题 I use Android Studio and I need an emulator with Play Store support to test the development. However, I could not see the emulator with Play Store support in the Device Manager section in Android Studio. Do I have to buy a physical Android TV device? Do you have a suggestion for this? Please. 回答1: When you open Android Virtual Device and click Create Virtual Device, select TV on the side and pick either 1080p or 720p. On the next screen, select Android Q but be sure it's the API level 29

Cannot build a project due to play-services-base-17.1.0.aar transformation error

夙愿已清 提交于 2021-01-28 19:53:18
问题 So basically I haven't opened my Android Studio project for almost a year and this time was the time for it to be opened and built. After updating Android Studio and all of the project's plugins, I finally reach this error: Execution failed for task ':app:processDebugResources'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform play-services-base-17.1.0.aar (com.google.android.gms:play-services-base:17.1.0) to match attributes {artifactType

Places API autocomplete problems

为君一笑 提交于 2021-01-28 19:31:31
问题 Hi I'm new to android and am setting up the autocomplete code for the places api. I was following the google dev instructions on their website and ran into a problem that I can't seem to find any answers on. I can't seem to find any info on what i am supposed to put for ID and NAME on the first line. There are no auto complete suggestions that come up and I haven't been able to find any info on it on the official documentation. I believe I have imported everything that I need to as I don't

Converting an entire layout to an image/bitmap

和自甴很熟 提交于 2021-01-28 14:40:32
问题 I have been having an issue with this one line of code for a while and I would really apreciate it if any of you have ideaas about it. What I am trying to do is, save a specific layout( in this case a relative layout) as an image when a person hits a button. this action will transfer the image to the next activity. I'm pretty sure the actual act of transfering is not the problem. It's how I'm converting the layout to an image. below is the code with comments: Here is whats on activity1 //

How to remove unnecessary blank line on code formatting in Android Studio

巧了我就是萌 提交于 2021-01-28 10:45:13
问题 Is it possible to remove unnecessary blank line on code formatting in Android Studio? 回答1: Yes. It is possible to configure the number of blank lines in the settings menu : File -> Other Settings -> Default Settings... -> Code Style -> Java(or whatever your language is) -> Blank Lines 来源: https://stackoverflow.com/questions/49020651/how-to-remove-unnecessary-blank-line-on-code-formatting-in-android-studio

How to remove unnecessary blank line on code formatting in Android Studio

 ̄綄美尐妖づ 提交于 2021-01-28 10:42:42
问题 Is it possible to remove unnecessary blank line on code formatting in Android Studio? 回答1: Yes. It is possible to configure the number of blank lines in the settings menu : File -> Other Settings -> Default Settings... -> Code Style -> Java(or whatever your language is) -> Blank Lines 来源: https://stackoverflow.com/questions/49020651/how-to-remove-unnecessary-blank-line-on-code-formatting-in-android-studio

How to remove unnecessary blank line on code formatting in Android Studio

时光毁灭记忆、已成空白 提交于 2021-01-28 10:40:34
问题 Is it possible to remove unnecessary blank line on code formatting in Android Studio? 回答1: Yes. It is possible to configure the number of blank lines in the settings menu : File -> Other Settings -> Default Settings... -> Code Style -> Java(or whatever your language is) -> Blank Lines 来源: https://stackoverflow.com/questions/49020651/how-to-remove-unnecessary-blank-line-on-code-formatting-in-android-studio

How to create a folder in Download directory (Android Studio)

时光怂恿深爱的人放手 提交于 2021-01-28 10:37:23
问题 I'd like to create a directory in a Download directory (the one which stores all the files I download from web) so I can see it in browser after I plug the mobile into my PC. File myDirectory = new File(dir, "NewDirectory"); What should be the value of dir? 回答1: File dir = new File(Environment.getExternalStorageDirectory() + "/Download/your folder/"); dir.mkdirs(); // creates needed dirs Don't forget to ask for permissions on Marshmallow or newer and to add the write storage permission to

How to create a folder in Download directory (Android Studio)

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 10:27:09
问题 I'd like to create a directory in a Download directory (the one which stores all the files I download from web) so I can see it in browser after I plug the mobile into my PC. File myDirectory = new File(dir, "NewDirectory"); What should be the value of dir? 回答1: File dir = new File(Environment.getExternalStorageDirectory() + "/Download/your folder/"); dir.mkdirs(); // creates needed dirs Don't forget to ask for permissions on Marshmallow or newer and to add the write storage permission to