Is there a way to autoformat code in Android Studio? - java

I have been coding for a while in Visual Studio with visual basic and there was an option to autoformat code at the same time you were coding.
I know i can format it in Android Studio with CTRL+ALT+L but is there any option so the software do it automatically?
Thanks.

You can't, you must do t 'manually' with the macro, the closer option is maybe to map the macro on ctrl+s to save and format at the same time.

Yes, it's possible. There's an IntelliJ plugin called save actions that will allow you to do this.
https://plugins.jetbrains.com/plugin/7642-save-actions
instructions (plus more) here https://jivimberg.io/blog/2018/06/10/intellij-idea-tips/

Related

Android Studio Java Syntax Color Scheme

I am using the latest Android Studio version at this time (2.3.3) and I did not have much experience with Android Studio before, when I started to use it now, I feel a bit uncomfortable with the Java syntax.
I do understand that there is a way of changing each attribute colour, if you go to "Editor> Colors & Fonts> Java" I will be able to modify the Scheme myself, but I'm not too sure about how to manage it.
I've been using Eclispe and SublimeText before, and in Sublime it is much easier to understand the code and visually get around.
Android Studio Syntax:
Sublime Text Syntax:
Maybe there is a way around it, where I can import a scheme or a tutorial how to set the correct colours for a correct attributes?
For those that are trying to achieve what I wanted, there is a GitHub repo called sdvoynikov/color-themes where you can download a lot of themes from there and then import into an Android Studio.
Step 1 : Download jetbrains-monokai-sublime theme
Step 2 : Extract the zip.
Step 3 : Go to File -> import settings -> and select the Monokai-Sublime.jar where you previously extracted the zip.
and you are done
Install Java Code Styles, which is compatible with IntelliJ IDEA and Android Studio.

System of help for Android Studio?

this is my first time with Android Studio and I can remember when you try to use button functions eclipse shows the functions available and text of description, but Android Studio no...
For example: button.setOnClickListener()....
This system of help it's available in Android Studio?
Sorry for my english and thanks in advance!
Do you mean suggestions?
Check if CTRL + Space bar is what you are looking for as these stand for suggestion by default. Please notice Android Studio is based on IntelliJ IDEA, so all IDEA's shortcuts should work in AS as well.Read more about code assistance here.
By the way - you can set your shortcuts to be Eclipse-like.
You may also want to read FAQ for Eclipse Users
Edit.
Ah, I posted so many link already, I'll post one more: Default shortcuts keymap

How to build and use ffmpeg within android

I am prototyping a fairly simple camera app to test out using MediaRecorder to create a custom camera activity with one snag, I want to set the aspect ratio of recorded videos to a 1x1. Through much research I have found that this is only possible by using a library like FFMPEG to crop each frame of the video to the size I desire.
I have read many tutorials and articles on different ways to build FFMPEG into Android, but most of them are either outdated and use older versions of both the Android NDK and FFMPEG, or more recent ones just do not work when followed. I tried following the popular http://www.roman10.net/how-to-build-ffmpeg-for-android/‎ and a few other similar ones that all lead to an error about a missing pkg-config file because FFMPEG is generally meant to be installed on linux or another OS apparently. I found some information about building FFMPEG in android by using a make-standalone-toolchain.sh file here http://software.intel.com/en-us/android/blogs/2013/12/06/building-ffmpeg-for-android-on-x86 and can't make heads or tails as to how to go about using this method.
This now leads into my question: What is the best/proven way currently to build and use FFMPEG within android applications? If the standalone toolchain method is the way to go, is there any material better than the one listed that is easier to follow? I would even be open to a reliable template application with the FFMPEG Libraries ready to go (if this is possible); although, I would much rather know how to build this into android for future use.
Thank you in advance for any advice or suggestions on this issue.
I have successfully build ffmpeg libraries using
https://code.google.com/p/dolphin-player/
You have to be on Ubuntu to build that.
This is the guide I liked the most: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
If you need more options, you can take a look at these, which are equally good:
https://github.com/guardianproject/android-ffmpeg
https://github.com/halfninja/android-ffmpeg-x264
https://vec.io/posts/how-to-build-ffmpeg-with-android-ndk
EDIT: I updated the first link with a more recent article (it uses NDK r9).

CaptureFromFile in OpenCV on Android in Java

Maybe I'm being a bit slow, but I can't find the equivalent of CaptureFromFile for grabbing video frames one by one from a file in OpenCV in Java on Android.
Can anyone put me out of my misery please and show me where to look?
Many thanks
Barry
OpenCV does not support video reading/writing on Android yet.
Take a look at solution in here. Also, it seems like Open CV is available thrue Android NDK, here you may find how to use it. In addition, you may take a look at Processing, which i believe supports Open CV and able to export code as apk.

Is there a real Android visual designer for IDEs?

I'm trying to develop an Android application with UI. So it's little complex for me to create UI with codes. I was using Visual Studio for long time where visual design is piece of cake. I also used Netbeans and Eclipse for java applications with UI but when it comes to Android I can't find a good way for UI desing. There is a visual design part in Eclipse but I want to use Netbeans as long as it's possible. Also I think DroidDraw is not good enaugh too. So I seached on web for Netbean's visual design tool and found nothing. If there is no tool or plug-in like this WHY? Thank you for any help.
Edit:
Well, long time passed. I just get used to code my ui. Also I am using Android Studio. 8)
edit
just saw that you've used DroidDraw.
There is official GUI designer included in ADT. Browse for main.xml (project/res/layout/main.xml) and doubleclick it :)
enjoy!
The combination of ADT (Android Development Kit) and eclipse 3.1 + will help you to develop the application graphically. Once you open the layout xml files, click “Graphical Layout” tab at the bottom of the section to open the graphical view. Now you can drag and drop components & also update layout.
But it is better to understand how the xml is defined in the layout. This will help you to fix any problems (in case).
Hope this helps.
Using Embarcadero RAD Studio XE7 (delphi or c++builder) allows for that task but it builds apk files with ome 10mo,

Categories