Write in front:
As a beginner, just a half-foot into Android Development, after using Eclipse to develop two self-sensing marketplace- like apps . Some problems have been encountered, summarized for example the following:
1, Code reusability.
Findviewbyid , onclick events and so on. Repeating this kind of boring code over and over again is a waste of life, and this problem is recommended by the dependency Injection framework butterknife . Directly generates all the controls in the layout, including the onclick Click event, but controls such as the row layout item . and How to use the framework to solve the layout of include reuse. This is still to be seen.
There is also a very high rate of code repetition is the HTTP callback processing. Interaction with the server is unavoidable to parse the JSON data that is returned, and to do the corresponding processing according to the status in different states . This problem can be reduced by a portion of repeated code by encapsulating the callback listener listener .
2, Limitations of development tools. When usingGitHubusing some of the great God's open source libraries, you'll findEclipseare increasingly marginalized. Take a look at my blog percent layout article. Many tool classes/use of the library,Android Studiothe user only needs toGradlecan be easily integrated by adding a single line of code. Eclipseusers can only be able to get their own copy of the relevantJavaclasses and files. Let 's Get aDemoIt can be used to integrate into the project, which is time consuming and laborious. Therefore, to solve the problem, learnAndroid Studioit seems very necessary. My own in the use of Android Studio is also smattering, but some of the problems of the solution also cost me a lot of energy, so even some simple knowledge, but also hope to help the same encounter these problems of friends.
Then the text starts.
First is the first step in getting started with Android Studio:
Installation of Android Studio: Domestic Mirror Address
The installation process is not taught. After the installation, some people may encounter click the program and then flash, can not open.
Workaround: Change the configuration file: Android-studio\android-studio\bin\idea.properties. Added at end of file: Disable.android.first.run=true
Tutorial first set up some of the parameters, 工欲善其事 its prerequisite.
Ways to enter settings are:
(1) Start interface: Configure-settings, (2) File-settings, (3) Click the top toolbar icon
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">
Partial configuration Setting Method:
1, the theme of the settings. Darcula is the legendary geek's black theme.
2, font settings, search bar search font, direct changes, real-time preview below, suggested changes after clicking Save as a copy
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">
3. Display line numbers, which makes it easy to locate bug locations based on error logs
4, the play comes, shortcut key style settings, but even if the direct settings eclipse will still have some shortcut key conflicts, this will refer to the following
5, Lenovo shortcut key. Conflict, I chose to ignore the conflict and forcibly change it into the same alt+/as Eclipse. After all, this is too often used.
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">
6, set the legend to not distinguish between uppercase and lowercase. Just when the XML interface is being edited, for example, to enter <button>, you must first enter < to associate, and you have not found where to set up imaging eclipse, the random symbol letters can be associative.
7, encoding
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">
8, some friends want to open as directly into the project. Skip selecting the project's Start screen and uncheck reopen Lase project to
9, Code area background color settings
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">
10,android Studio is different from eclipse. After Eclipse associates the method with the method, the method will default to the parameter, so we just have to change it, and when studio associates the method, the parentheses are empty.
But there will be a hover box tip:
This suspended window will greatly facilitate our writing of the method. Change the corresponding reference method such as the following:
10.1: The time when the suspension window appears after the Change method is finished
10.2: Suppose you finish writing the method. Moved elsewhere and then moved back. Forgot the number of parameters needed in the method. Then there are two methods: 1, the mouse is placed on the method name. An introduction to the method appears.
2, use the shortcut key to display the hover window, shortcut key change method: (I changed to ALT +.) , this shortcut is also a conflict, but temporarily did not find what is wrong with it)
Another non-ctrl+1 shortcut in 11,eclipse, for example, when we are in new class. New A (), press CTRL + 1 and actively associate it with a A = new A (); In studio you need to set up another:
12, change the default gaze information.
Gaze information added at the top of the file each time a new Java file is created.
Here are some of the different shortcuts that are available in Android Studio for Eclipse:
Insert blank line up: Ctrl + Space
Error message: ALT + ENTER
Generates a construction method. Set and GET, etc.: ALT + Insert
Local variable becomes global variable: CTRL + ALT + F
Refining method: shift+ ALT + M
Resource File Rename: Alt+shift+r
Where to view the method is used: Ctrl+g
Clear Invalid Package: Ctrl+alt+o
Other might use the process to continue to fill the whole. You want to change the relevant shortcut keys. Just make a random point within the Keymap shortcut. Change to the original key.
For example error prompt ALT + Enter with not used to want to change the key, but do not know the location of the error prompt key, this is just to select a change in keymap to ALT + ENTER. In the Prompt box, you will be prompted to indicate which function conflicts with this key combination. Find the location based on the hint of the scarlet Letter, which is where you want to change the function.
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">
This is the basic setup for Android Studio.
Stay hungry, stay foolish. Goodbye to the next blog post.
Eclipse Goodbye, Android studio Novice Beginner Tutorial (i) Basic settings