new Android Studio Starting to use the application android development 2015

ptjqatar

Last week we told you about the first steps to take in the new Google IDE I present to program applications, Android Studio. Today we start making our application. Before you start, remember you can download it here.
Android Studio
Android Studio - Download Link

We continue ...

Where we left the other day. We had done the previous steps of the application. Now we have a window open Android Studio as follows.
V1
Currently this window is empty. But as we see in the center of the window to open the file directory of the application must press Alt + 1.

Keyboard Shortcuts

Besides Alt + 1 and other shortcuts that advises you Google in the bottom of the window Android Studio, there are other shortcuts that you see below:
ActionAndroid Studio Key Command
Command look-up (autocomplete command name)CTRL + SHIFT + A
Project quick fixALT + ENTER
Reformat codeCTRL + ALT + L (Win)
OPTION + CMD + L (Mac)
Show docs for selected APICTRL + Q (Win)
F1 (Mac)
Show parameters for selected methodCTRL + P
Generate methodALT + Insert (Win)
CMD + N (Mac)
Jump to sourceF4 (Win)
CMD + down-arrow (Mac)
Delete lineCTRL + Y (Win)
CMD + Backspace (Mac)
Search by symbol nameCTRL + ALT + SHIFT + N (Win)
OPTION + CMD + O (Mac)
BuildCTRL + F9 (Win)
CMD + F9 (Mac)
Build and runSHIFT + F10 (Win)
CTRL + R (Mac)
Toggle visibility projectALT + 1 (Win)
CMD + 1 (Mac)
Navigate open tabsALT + left-arrow; ALT + right-arrow (Win)
CTRL + left-arrow; CTRL + right-arrow (Mac)
You can consult other interesting tricks in page Android developer Studio .

The tree of folders and files

After pressing this key combination, we will be open and l tree application folders on the left (if this window is movable. For if ye more useful elsewhere window Android Studio, know that you can move clicking and dragging where it says "1. Project" anywhere. You can also move the other windows that you can open by pressing Alt and a number from 1 to 9).
V2
In the directory tree you have several ways to list the folders and files of the application.The two main ones are "Project" and "Package", but others can use. For example,"Problems" display only those files that have errors. Something very useful. You can switch between them down on black date on top of "1. Project" window. Depending on the changes that you make between files to build the application.
From my own experience, it seems that the faster find everything ready as if "Packages".Although it is true that in general tend to have many tabs open and closed directory tree.
Well, now we must locate the most important for our application files. From the list "Project", we can find the AndroidManifest in "your App Name"> src> main> AndroidManifest.xml.
v3
The Activity (or Activitys) we have created are in "your App Name"> src> main> java> "Pack your App".
v4
Some of the other essential files of any Android application found in the "Name of your App"> src> main> res folder. Once inside you see, "layout" or "menu".
v5

Implementing preview

Well, let's open "activity_main.xml". It is located under "Name your App"> src> main> res> layout. We are open multiple windows as you see in the image below.
v6
On the left you can find the elements that you can add to the design of your application. As you see, you have plenty of options to choose from.
In the center, you can see a very useful and very complete preview of how it is becoming our application. There, you can change the device to see how it would beanother inch screen with others. Try how it looks in vertical or horizontal, translated to another 



language (useful if a sentence lengthens and remains incomplete) and some more options. Also, you can see at the bottom tabs "Text" and "Design", to switch between writing code which will then be visible or mount through design.
On the right you have a window which is divided into two parts. At the top, you can add the items that you have left. Also you can add in the preview. In either case, the code is added to the tab "Text".
At the bottom, the options for each of the items that you añadáis appear. How in the previous case, you can add it manually by typing the code in "Text".
Let's look at what tabs show "Design" and "Text" and we will do a "Hello World" to preview it. Delete everything there under Device Screen (if any) and add a "Relative Layout" and within a "Plain Text". In the "Design" tab will see the following:
v8
And in "Text" will see the code as follows:
v7
But, as we indicate the red lines, there are errors in the code. Android Studio tells us what is our fault and, sometimes, how we can fix it. Let's see what is the problem in our case:
v9
Apparently I have more than one item as root. Which suggests that closed prematurely have the first element. Delete the remaining bar and you're done.
v10
No errors, but there is a yellow warning symbol. That tells us that our code is correct but incomplete. In this case, the string or "String" that is linked to "Plain Text" and it will appear as text on your screen of the device (or emulator) we need.
Returning to the "Design" view. Top right, where are placed the two elements "Relative Layout" and "Plain Text" see a warning in the latter. We press on it to solve the problem and add a text string.
v12
By clicking the Message, will show another window in which we can add the name we give to the chain. Eye, which we write in this drawer is not what will be displayed, otherwise the variable name "String" to which reference is made. We can also choose what type of file (Dimens, Strings or Styles) and save that folder or folders (very useful to use the same text in multiple places in the application).
v13
Once the added name, we the warning disappears, plus you have successfully changed a line of code to "Text":
v14
We return to "Design" and now press Alt + 1 to open the browser. We search the folder where the file where we added the chain is. In this case it is "your App Name"> src> main> res> values> strings.xml. Open the file and see something like this.
v15
Here, we can substitute the name field we have assigned to the chain. In this case, the string is "hello" and the value is "New Text". We changed the value "Hello World".
v16
We return to the activity_main tab and look in "Design", how our app now. We see the text that appears below the menu bar has changed.
v17

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Accept !