[Q] Change Auto-Format in Android Studio - Android Q&A, Help & Troubleshooting

Hi all, I've recently started using AS and there is one thing that really winds me up.
The auto format places curly braces like this:
Code:
Call();{
Code
}
And that just makes it harder to read in my experience. Is there anyway to change it so that it is more like Visual Studio's format which is:
Code:
Call();
{
Code
I know it's a small change but it would make a big difference; obviously I'm aware I can change it all manually but with the stupendous amount of auto generated files this seems rather implausible.
Any help would be greatly appreciated.
Thanks

Related

Best practice for storing configurations

Hello everyone,
I'm new to Android development. I've written my first little "get my feet wet" ap and am looking to expand on it. One thing I would like to do it give the user more options of things they can configure and I'm wondering about the best way to store that information.
At what point does it become worthwhile to start using mySQL vs just using string data in the prefrences? Or is there another option I've missed (maybe an xml file, but I'm not sure where that would be stored?).
In my case, I'm thinking I have fewer than 100 instances of an object (or objects) that would have 3 or 4 properties associated with them.
Thanks!
Use the SharedPreferences class, is the easiest way to achieve your goal (BTW, SharedPreferences generate a xml file to storing your preferences).
SharedPrefrences is what I used for my basic version, but my understanding is that it allows for name-value pairs right? That works well when you have a predetermined set of prefrences, but what if it's more fluid?
Say I want to allow the user to configure his widgits, and each widget has a number of properties - say "color", "number", and "size". Maybe one user will configure 3 widgets and another user might configure 25.
I can think of a couple of different ways to parse this out into name-value pairs, but is that the best way?
Yep... for me that is the best way. For each user you can put the values using someting like this:
UserName+WidgetID+"PreferenceName"
And thats all... the preferences will be unique for each case, without parsing and 0 errors
Ok, cool. That's one of the options I had considered but didn't know if that would be the most efficient. Of course I'd also have to have a list of all the "Widget ID's" stored in a preference to loop through as well.
I assume the maximum amount of data that can be stored in one prefrence is just whatever the Java max string length is...is that correct?
Yes, you're right

Need Help! Remote control of android

Hi everybody!
I"m writing an app,for remote control of android and faced with one problem. I want not to make printscreen of device screen to send it to client,but I'd like to catch comands on drawing inside the system and send copy of them, to make app more quickly. Everybody knew,that there is a large variety of way of drawings, but as I understand at lust there is a special piece of system which get all commands on drawing and draw inside frames? So I would like to know what is it?
Now I found out that SurfaceFlinger allocates a frame buffer for window,but it is not what draws window,so what draws window??

[Q] How to import glossaries?

Hi!
As you all know the Android virtual keyboard can offer suggestíons on the fly, when typing your text. However, these suggestions may be limited in lack of a good dictionary. So, people usually start to add new words to their custom glossary. This process could be made quicker by importing a glossary, but one has to know the exact format requirements and the folder where this dictionary must be placed. Please share any tips&ideas on this!

CameraX and Camera2Config Extender, Camera2Interop... stuck there, help needed :)

Hi all,
I1m developing a camera-using application in Java, and stuck at a point where i need to control the camera settings. Any help will be appreciated...
The main problem is that i need to lock white balance (or turn it on a fix state, as daylight, etc.). I found that there are 2 methods : Camere2Config Extender and Camera2Interop. The app needs to display a preview, and do some image analysis, which is already working. The WB control is enough to apply to the analysis, but as i understand, if i apply to the preview/config the camera, it will also affect the analyzer, as it gets the same frames.
Camera2Interop seems to be easier, but i cannot import (in Android Studio). Simply does not understand the "interop" in
Code:
import androidx.camera.camera2.interop.Camera2Interop;
import androidx.camera.camera2.interop.ExperimentalCamera2Interop;
What can i do to let the Studio import these?
Second, i tried Camera2Config.Extender. But cannot figure out how to extend the configuration, and which? The preview config seems to be the good choice.
But when i try :
Code:
PreviewConfig pConfig = new PreviewConfig.Builder().setTargetAspectRatio(aspectRatio).setTargetRotation(0).build();
Camera2Config.Extender camera2Extender = new Camera2Config.Extender(pConfig);
Preview preview = new Preview(pConfig);
I get a "error: incompatible types: PreviewConfig cannot be converted to ExtendableBuilder Camera2Config.Extender camera2Extender = new Camera2Config.Extender(pConfig);" message. It builds when i remove the Extender.
If anybody knows how to get rid of these, i'll be thankful

Modifying game files through APK

Recently I began playing a game called Gigabit Offroad on my old Pixel XL, and i eventually got bored of the endless grinding the game required. To combat this, I navigated to the games data directory and changed a few simple values in the “com.gigabitgames.offroad” xml file. I was able to give myself virtually unlimited balance etc, however the power and grip capabilities of all cars are severely limited by the max upgrade value. I’m not a programmer, so i’m not very familiar with how such games function. I discovered that there was a “powertrain” category for each car in the xml, and when the cars were fully upgraded in game the string would read the same for each car, despite their differing performance. Changing these values resulted in crashes, so I can’t manipulate them for better stats. One of these lines looks like this:
Code:
name=“YotaCurrentPowertrainOption”>akJlx+NHZwzEMKo8ZZoyiw==</string>
I assume the incoherent characters in the string refer to a configuration file for each level of upgrade somewhere, which i believe would be a percentage of increase compared to the stock performance of each car, considering they all have the same characters. This leads me to believe that there is a configuration file for each car somewhere, but despite scouring the apk and the obb i could find no trace of anything. I would greatly appreciate it if someone who is familiar with Android and/or Unity programming could point me in the right direction. I understand that this is not a direct referral to a different string, as it is just characters and not a directory. As you can probably tell, i’m not very coherent in this field and I’ve pretty much stumbled my way into getting this far. I would greatly appreciate any help.
Thanks in advance,
Wilson

Categories

Resources