Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
π About the author
As we all know, life is a long process of constantly overcoming difficulties and reflecting on progress. In this process, there will be a lot of questions and thoughts about life, so I decided to share my thoughts, experiences and stories to find resonance!!
Focus on Android/Unity and various game development tips, as well as various resource sharing (websites, tools, materials, source code, games, etc.)
Welcome to pay attention to the public account [Mr. Empty name] for more resources and communication!
π premise
The current environment
2020.3.1 Patch 2 version was last downloaded on October 8, 2021
π Practice
π Quickly view the Activity name corresponding to the page
Docking project is an essential link in the work, download and import learning open source project is also a matter of time, the current page to find the corresponding class, sometimes really delay a lot of time, so we need to use “means” to quickly find the current class.
If the current project inherits a unified BaseActivity (if not, write your own BaseActivity inheritance), then add it to onCreate:
Log.e(“TAG”,” +getClass().getName()) “);
After running, the log can be viewed at any time, ah, very convenient, once and for all ah
πAndroid Studio comes with screenshot function
In the development process, there are many scenes need screenshots and videos to communicate with others. Generally the first thing that comes to mind is the real machine screenshots and video function, yes, this method is very right.
But there’s another good way.
Android Studio provides screenshots and videos that can be saved directly to your computer, which is a great convenience in development. Send it to whoever you want.
π format automatic sorting code
With constant updates, or even no updates, there will be more methods and more code. If there are too many methods encapsulated in the same class, it’s A, B, C, and D.
If you write disorderly instead of following the order, it will lead to more and more chaos. Forget about people reading your code, you’ll have to look it up in a few days, or even search for it.
So we want our code to be as close as possible, like A, B, C, and D, so these four methods are right next to each other. Of course, you can do this in the middle of writing code, but don’t trust yourself so much that you can forget this rule and, over time, mess up again.
So we need to borrow tools to help us deal with it. Fast and safe, not to forget.
[file-settings-editor-code style-java-arrangement]
It’s basically the two things in the box above:
Keep overridden methods together
γkeep orderγ γorder by nameγ in alphabetical order. This feature is a method ordering setting with the Override flag. These methods are either systematic or custom, and are more formal together. It is recommended to use [keep Order] directly.
Keep dependent methods together
(2) First order, first order, first order, first order, first order, first order Breadth sorting is sorting method A, sorting method B, not managing the order of methods in the method, and depth sorting method A, there are nested methods in the deep sort, not back to find the next method.
Ctrl + Alt + Shift + L
At this point, when using the shortcut key [Ctrl + Alt + L] to format code, it will set rules to sort methods with the feeling.
π other
π’ author: Kom and Kom in Kom
π’ reprint instructions – be sure to specify the source: Zhim Granular’s personal home page – column – Nuggets (juejin. Cn)
π’ welcome to like π collect π message π