In the previous article, I have written in detail about, how to know closely the functioning of Android Studio and in this edition we will learn some other elements of Android Studio. It is important to learn and know Android Studio in complete detail so that ultimately, when you begin processing of coding you could find more and easier form of understanding entire bit of processes without any difficulties and confusions.
Android learning experience:
Inside Android Studio the android apps works in two ways. Inside main interface of android app the layout, and its front end and other elements which can be seen inside android app layout inside Android Studio.
When you click on ‘MainActivity.java’ you will find java codes of application out there. This is field where we will write java codes. So, from the top you can change to two views. One is the lay out view by clicking on ‘content_manifest.xml’ and then if you want to write code then you can switch to ‘MainActivity.java’.
As I have stated in the previous article, from ‘Content_manifest.xml’ we could write two ways, one is from widgets that is design form and the other is from text that is writing xml codes into it. This two tabs provides smoother ways to move from one segment to the other while developing an application. It is important to refer to previous article so that basic components of Android Studio can be well documented and understood.
After learning about layout of Android Studio in the next segment we will be learning about some Android Studio tips so that ultimately while preparing for writing of code these tips should be extremely helpful for us.
Helpful Android Studio tips so that you should have convenience while programming Android Apps with Android studio:
First you should know about what are short cut keys available to Android Studio. It is important as while working short cuts works best and you should have one list with your computer table so that ultimately you could refer to these keys on yours left hand side by looking those lists in detail about it. All about is to go to ‘Help’ and then click on ‘keymap reference’. Connect to internet and click on that link. The link will open into a new window. It will open with yours default web browser.
Download it and use it as your reference. It is an wise idea to print it out and then keep it beside your laptop so that ultimately you could refer to all of these while writing code so that this could expedite the process.
Choosing theme for Android Studio:
You can change the theme of layout of Android Studio. Some have been very much comfortable with the presence of darker themes or windows theme. For this you go to ‘File’ then ‘Settings’ or use short cut ‘Cltr+Alt+S’ and then it will open ‘Settings’ on a separate window. From there click on ‘Appearance & Bahaviour’ and from there you should click on ‘Appearance’ and then move into the right side of ‘Settings’ window. Now, go to ‘UI options’ on the right hand side.
From there go to ‘Theme’ and then click on the drop down to see all the available themes. You have ‘Darcula’ and ‘Windows’ theme in addition to the default ‘Intellij’ theme. Choose any of theme. The ‘Darcula’ theme is for darker theme and the ‘Window’ theme for the same as the current window you are using. Select the theme of yours choice and then click on ‘Apply’ to apply the choicest theme into Android Studio.
Show line numbers inside ‘MainActivity.java’:
Next go to layout interface or default interface of Android Studio and here we will straight go into ‘MainActivity.java’ and click on it to see java codes out there. On the footer side of Android Studio you will find ‘Event Log’ and from there you could find the errors and the entire process of coding inside ‘MainActivity.java’ and this makes entire running of apps smoother. When you find any error inside ‘MainActivity.java’ you can check the footer areas and find out on which line the fault with codes exists.
In ‘MainActivity.java’ by default the line numbers are not shown. Then how would you find the line number. It is easy. Just right click on the gutter side of ‘MainActivity.java’ and then check ‘Show line numbers’ and you are done and with it now line numbers of each and every code could be found easily. Now it has become easier for you to track all the codes and deficiencies found in which line of code can be found from these line numbers.
How to turn off Code folding:
Now we have another structure known as ‘code folding’. It is situated between ‘line structure’ and ‘code palette’. It is basically a set up of codes that are similar in nature and constrained to one single structure in order to shorten the longer code infrastructure inside code palette. Only if you want it then you can click that code folding and the plus sign of code folding opens up. Most of times while writing of code this might provide absolute confusion and for this it is essential to move towards the provisions to remove automatically inclusion of code folding.
So, it is time to turn off code folding. This is very easy.
Go to ‘File’ then ‘Settings’ and then click on the ‘Editor’ option and then we have the option of ‘General’ and then ‘Code folding’. Then move to the right hand side and uncheck all the check boxes from there and then click on ‘Apply’ and ‘ok’. In this way the similar codes will not be folded from now on and the prolonged and detailed code views inside ‘MainAcitivty.java ’ can be found easily.
Screenshot code folding
Now, go to ‘MainActivity.java’ and you could see all the codes are now in expandable element and most of it is now visible. This should help you immensely while writing and debugging of codes.
What it makes ultimately is to create more and more conveniences for you while writing codes and there will be no such confusions and other related embarrassments while you keep on writing and developing apps. So far in the last three articles we have been reading and understanding about entire interface of Android Studio and how to recognize and manage it and how to store all the short cuts and again we also learn about code folding, changing of themes and so on.
In the future, we will be learning about how to create android virtual device manager, android code management and how to utilize the footer of Android Studio that is of ‘Gradle Console’ and how to build the app in congruence with ‘Event Log’ so that when the app is running with emulator you could find more information about it through event log about running app. So,stay tuned and learn coding.