3
readers helped!

This helped me

How to Use Android Studio

Android Studio is the official integrated development environment (IDE) used to develop apps for devices that use the Android operating system. Android devices include smartphones, tablets, smart watches, smart TVs, and even smart devices like cameras and home appliances. The official programming language for Android is Java. Therefore, it helps to have a little knowledge of Java coding to be really efficient at Android Studio. This How.com.vn teaches you the basics of how to use Android Studio.

Part 1
Part 1 of 2:

Getting Started

  1. How.com.vn English: Step 1 Download and install Android Studio.
    Android Studio is free to download and install. Use the following steps to download and install Android Studio:
    • Go to https://developer.android.com/studio in a web browser.
    • Click Download Android Studio.
    • Check "I have read and agree with the above terms and conditions".
    • Click Download Android Studio for Windows or Download Android Studio for Mac
    • Double-click the Android Studio Installer file in your Downloads folder or web browser.
    • Follow the on-screen instructions to finish installing Android Studio.
  2. How.com.vn English: Step 2 Open Android Studio.
    Android Studio has a green icon with an image that resembles a drawing compass in the center. Click the Android Studio icon to open Android Studio.
  3. How.com.vn English: Step 3 Create a New Project.
    When you create a new project, you can select which device you want to design an app for as well as an activity. Use the following steps to create a new project:
    • Click File.
    • Click New.
    • Click New Project.
    • Click one of the tabs at the top to select a device.
    • Select an activity (optional), or select No Activity to design an app from scratch.
    • Click Next.
    • Type a name for your project in the first bar.
    • Use the third bar to select a save location (optional, the default save location is "C:\Users\[username]\AndroidStudioProjects")
    • Use the drop-down menu next to "Language" to select Java or Kotlin.
    • Use the drop-down menu next to "Minimum SDK" to select the minimum version of Android your app will run on.
    • Click Finish.
  4. Step 4 Open the "activity_main.xml" file.
    Use the Project panel to the left to open different files for your app. Use the following steps to navigate to and open "activity_main.xml":[1]
    • Select "Project" from the drop-down menu above the Project panel to the left.
    • Expand your app name at the top of the Project panel.
    • Expand app.
    • Expand src.
    • Expand main.
    • Expand res.
    • Expand layout.
    • Double-click activity_main.xml.
  5. How.com.vn English: Step 5 Click Design, Code, and Split to switch view screens.
    Click one of the three view screen options in the upper-right corner above the view screen panel to switch view screens. Design view displays what the screen will look like when installed on your app and allows you to add visual elements. Code view displays the Java code and allows you to edit the code. Split view displays both the design view and code view in a split screen.
  6. How.com.vn English: Step 6 Delete objects on the screen.
    You may have some default objects on the app screen that you don't want to keep. To delete them, first click Design to switch to Design view. Then click the object on the screen that you want to delete and press the Delete key.
    Advertisement
Part 2
Part 2 of 2:

Adding Objects

  1. How.com.vn English: Step 1 Add a text box to your app.
    Text boxes can be used to display text on the screen of your app. You can use the "Attributes" panel to the left to edit the text in the box as well as give the text box an ID that can be referenced in your Java script. Use the following steps to add a text box to your app:
    • Click the Design tab to switch to Design view.
    • Click Text under the "Palette" panel to the left.
    • Click and drag TextView onto the screen.
    • Edit the text you want the text box to display next to "text" in the "Attributes" panel to the right.
    • Type a name for the text box object next to "Id" in the "Attributes" panel.
  2. How.com.vn English: Step 2 Add a fillable text bar.
    A fillable text box allows the user to enter their own text. This can be used to allow users to input their name, email, and other information. You can edit the sample text and object "ID" in the "Attributes" panel. Use the following steps to add a fillable text box to the screen:
    • Click the Design tab to switch to Design view.
    • Click Text under the "Palette" panel to the left.
    • Click and drag Plain Text onto the screen.
    • Edit the sample text you want the text bar to display next to "text" in the "Attributes" panel.
    • Click the flag icon next to "InputType" in the "Attributes" panel.
    • Click the checkbox next to the type of text you want the user to enter (i.g. textPersonalName, textEmailAddress, phone, etc)
    • Type a name for the text bar object next to "Id" in the "Attributes" panel.
  3. How.com.vn English: Step 3 Add a button to the screen.
    You can use the "Attributes" panel to the left to edit the button text and object name. Use the following steps to add a button to the screen:
    • Click the Design tab to switch to Design view.
    • Click Buttons under the "Palette" panel to the left.
    • Click and drag Buttons onto the screen.
    • Edit the text you want the button to display next to "text" in the "Attributes" panel.
    • Type a name for the button object next to "Id" in the "Attributes" panel.
  4. How.com.vn English: Step 4 Click the MainActivity.java tab to code your main activity.
    This displays the java script that makes your main activity a functioning app. You'll need to know a little about Java for this.
  5. How.com.vn English: Step 5 Add a new activity.
    Adding a new activity gives your app more than one function. If you want to make a tab or a button that opens a second screen in your app, you'll need to add a new activity. Use the following steps to add a second activity to your app:[2]
    • Right-click app in the "Project" panel to the left.
    • Hover over New.
    • Hover over Activity.
    • Click an activity type (i.g. Basic Activity).
    • Enter an activity name in the first bar.
    • Enter a layout name for the activity in the second bar.
    • Enter a title for the activity in the third bar.
    • Use the drop-down menu next to "Language" to select "Java" or "Kotlin".
    • Click Finish.
  6. How.com.vn English: Step 6 Open the XML file for your new activity.
    The XML file for the new activity is located in the same location as the first one. Use the following steps to navigate to and open your new XML file:
    • Expand your app name at the top.
    • Expand app.
    • Expand src.
    • Expand main.
    • Expand res.
    • Expand layout.
    • Double-click the XML file for your new activity.
  7. How.com.vn English: Step 7 Add objects to the new activity.
    Make sure you are in Design view when adding new objects. In addition to text and buttons, the Palette menu has all kinds of objects you can add to your app. Some examples include the following:
    • In addition to "TextView" and "Plain text" objects, the Text menu has objects for Emails, phone numbers, addresses, date, time, multi-line text and more.
    • In addition to simple buttons, the Buttons menu has image buttons (where you use your own graphics), checkboxes, radio options, a toggle switch, and a floating action button.
    • The Widgets menu has all kinds of objects you can add, including an ImageView, VideoView, WebView, CalendarView ProgressBar, RatingsBar, SearchView and more.
    • Layouts contains different design elements for your app.
    • Containers contains objects that are meant to house other objects, such as a Toolbar, NavigationBar, tables, scroll view items, and more.
    • Google contains an AdView option, and a MapView option.
    • Legacy contains older Android options.
  8. How.com.vn English: Step 8 Save your project.
    Use the following steps to save your project:
    • Click File.
    • Click Save all.
    Advertisement

Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit

      Advertisement

      About this article

      How.com.vn English: Travis Boylls
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Travis Boylls. Travis Boylls is a Technology Writer and Editor for How.com.vn. Travis has experience writing technology-related articles, providing software customer service, and in graphic design. He specializes in Windows, macOS, Android, iOS, and Linux platforms. He studied graphic design at Pikes Peak Community College. This article has been viewed 2,705 times.
      How helpful is this?
      Co-authors: 6
      Updated: September 24, 2020
      Views: 2,705
      Article SummaryX

      1. Download and install Android Studio from https://developer.android.com/studio.
      2. Open Android Studio and start a new project.
      3. Navigate to "app > src > main > res > layout" in the Project panel and double-click activity_main.xml.
      4. Click Design in the upper-right corner to switch to Design View.
      5. Click and drag objects in the "Palette" panel onto the screen view.
      6. Use the "Attributes" panel to the left to edit the object text, ID and features.
      7. Right-click app in the Project panel and click New > Activity" and select a new activity type.
      8. Open the new activity XML file in the project panel.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 2,705 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement