Android Studio Tutorial For Beginners

Date:

What Are All These Files

Android Studio For Beginners Part 1

I remember my first time using Android Studio was rather daunting compared with the programming experience Id had previously. To me, programming meant typing in a single script and then running that script. Android Development is rather different though and involves lots of different files and resources that need to be structured in a specific way. Android Studio exposes that fact, making it hard to know where to start!

The main code will be the Java file that has the same name as your activity. By default, this is MainActivity.Java but you may have changed that when you first set up the project. This is where you will enter your Java script and where youll define the behavior of your apps.

However, the actual layout of your app is handled in another piece of code entirely. This code is the file called activity_main.xml. XML is a markup language that defines the layout of a document much like HTML which is used for creating websites. Its not really programming but it is a kind of code.

So, if you wanted to create a new button, you would do so by editing activity_main.xml and if you wanted to describe what happens when someone on that button, you would probably put that in MainActivity.Java. Just to make things a little more complicated though, you can actually use any XML file to define the layout of any Java script . This is set right at the top of your Java code, with the line:

setContentView 

Creating A First Android Application

1. Once Android Studio is downloaded, open Android Studio and click Start a new Android Studio project on the welcome screen or File > New > New project.

2: Select an activity that defines the behavior of your application. For your first application. Select Empty Activity that just shows a screen, and click Next.

3: After that, you need to choose the preferred Programming language and hit the next button. You can either choose Kotlin or Java programming language. Know how to create an Android App using Java programming language with the help of this article on Android Tutorial. If you wish to know how to create an application using Kotlin language, kindly check out this article on Kotlin Android Tutorial.

4. Below snapshot represents the home page of Android Studio.

  • This section represents the project structure of an Android Application which comprise of the layout, result, and Gradle scripts.

  • This window is a Palette which comprises of a component that is essential for building an application. You can add a button, layout, image as per the requirement on to your app window.

  • This is a section where you can actually build your Android application using the Palette components. All that you need to do is just drag and drop the components.

  • This is a console in Android Studio which displays the result and the configuration tasks.

  • Now lets understand what is Android layout design.

    Android Layout Design

    • Main Action Bar
    • Content Area
    • Split Action Bar

    Java App Development Course For Beginners

    Has Java piqued your interest? Join our live online Java classes led by an expert instructor! Our Java classes are very well designed from basic to advanced levels, which enables students to learn Java language concepts all the way through developing apps. The concepts learned in each session will be used to create real-time projects.

    You May Like: How To Live Stream On Android Phone

    Stages To Publishing Your App With Android Studio

    The following stages are common to any development activity on Android Studio. Although there is a very simple explanation below, each stage has plenty of detailed concepts. It is outside the scope of this article to go into greater depth and details, but the project screenshot below explores a few key ideas.

    1. Writing Your App. The IntelliJ code editor comes in handy here. You can add codes in XML from templates, add app resources, design app themes, build a UI with a layout editor and configure app icons with image app studio.

    Example: the following screen demonstrates how to configure app icons. Select the app, go to res, right-click and create an image asset for the app from a variety of icons.

    2. Building and Running Your App. After youre done writing the code, you can build and run your app from a connected Android device or an emulator . This is possible through the Run menu item on top. As soon as the device is connected, you can run the app program.

    3. Configuring Your Build. In this stage you can do several things, such as set an application ID, optimize multiple builds, shrink code and resources and more.

    4. Debugging Your App. In this stage you can remove any embarrassing errors that may creep up in the app. For example, you can debug all tests to find out if any bugs still persist.

    5. Testing Your App. You can run a variety of tests from the command line, create UI tests and even record your tests.

    Who This Course Is For:

    Android Studio Tutorial For Beginners
    • Absolute beginners who wish to learn fundamentals of Android Studio and develop basic mobile app
    • Beginner Java developers curious about Mobile App Development
    • 4.2 Instructor Rating
    • 412,638 Students
    • 98 Courses

    “Youre big on Udemy. Top 10% most engaging instructors BIG. Which means students cant get enough of your courses. That kind of impact means youre the reason students start new careers, get promotions, or try something new that brightens their day. Your success is well deserved” Frank Visciano – VP, Marketplace Content, The Udemy Team

    Hello, my name is Syed Raza and I am passionate about teaching valuable skills to students who are motivated to learn! My goal is to help you easily achieve your goals and objectives, whether that means enhancing your existing skill set, gain productivity at workplace, differentiate yourself, learning the new technological skills that are required to improve your career.

    Over the last 20 years, I have acquired valuable skill sand experience that allow me to provide you with great learning experience. I have numerous technical IT and developer certifications (AWS, MCSE+I, MCT, CCNAincluding a PhD which enable me to teach a variety of powerful courses, from IT to Project Management.

    Providing technical and training solutions using AWS, Azure, Google Cloud, Red Hat OpenShift, Python, Java, JavaScript, React JS, GCP, Kubernetes, Jenkins, Ansible, and Docker

    Best Regards,

    Recommended Reading: Can Apple And Android Facetime

    The Other Files And Folders

    There are lots more files and folders here though, so what do they all do?

    In truth, you dont need to know what everything here is. But some things that are useful to know about:

    The Android Manifest: This is an XML file in the res folder that defines important features of your app. That includes the orientation of the app, the activities that you want to be included in it, the version, etc.

    See also: Xml: everything you need to know

    Drawable: This folder is found in res. This is where you will put things like images that you want to reference later.

    Values: This resource folder is a useful place to store values that will be used globally across your app. For example, this can include color codes or strings . Youll define these values in individual XML files, such as colors.xml.

    Gradle: Gradle is the tool that takes all your files and bundles them into a workable APK for testing. It is also useful for generating previews etc. You wont need to worry about the files in here often, but if you want to add a dependency, this is where you will do it. Dependencies are external libraries that let you access additional functionality from within your own code.

    Of course, we also have a detailed introduction to Gradle for new Android developers.

    The Complete Android Oreo Tutorial

    • Kick start into a new career with your new Android development skills and knowledge!
    • Learn the skills needed to obtain a new career developing Android apps
    • Step by step learn how to put Android applications together
    • Work more efficiently with Android development by learning the best tools and practices
    • Earn more with your new Android development skills
    • Learn how to develop apps for Android phones and tablets
    • Create your own professional quality Android apps
    • Join a large group of people who really understand Android Lollipop and are Android enthusiasts
    • Deploy Android app to the Google Play store
    • Crack your Interview for a job anywhere in the world
    • Feel proud with your new knowledge of Android app development

    Recommended Reading: Signature Pad App For Android

    Importing An Existing Project

    During your Android app-making journey, youll find times where you need to import existing projects. The steps below will guide you through how to import a project:

  • Download this project so you have a test subject.
  • Once downloaded, unzip the contents and place them somewhere easy to get to.
  • In Android Studio, go to File/New/Import Project.
  • A window labeled Select Eclipse or Gradle Project will appear. Select the unzipped project from Step 1 and click OK.
  • After Android Studio finishes importing, youll be dropped off on the screen below. Select the Project tab on the left panel as indicated in the screenshot below.
  • Youll now see all the necessary files of the imported project in the project explorer.
  • Its build and run time! Click the run button in the toolbar and select either the emulator or device youve already set up.

    Set The Default Activity

    Android Studio Tutorial For Beginners – How To Build an Android App

    After you choose the SDK, you choose a default activity for your app.

    Think of an activity as a window within your app that displays content with which the user can interact. An activity can take up the entire screen or it could be a simple pop-up.

    Your options on this particular template range from a blank activity with an Action Bar right up to an Activity with an embedded MapView.

    Youll make a lot of activities as you develop apps, so get to know them and know them well.

    Select the Blank Activity option and click Next.

    To speed this part up a little bit youll use the pre-populated default values, but what is actually done with these values?

    • Activity Name: This gives your activity a name to refer to in code. A .java class will be created and will use the contents of this text field to give the class a name, which will ultimately be the name you use to refer to this activity in your code.
    • Layout Name: Youre going to define your activity in Java, but the layout it shows to the user is defined in a special sort of Android XML. Youll learn how to read and edit those files shortly.

    Click Finish.

    Android Studio takes this as a cue to go do a bunch of behind-the-scenes operations and create your project. As it shoots out descriptions of what its doing, you may notice it says something like this:

    You see your project name, which is familiar. But then there is this Gradle word, and then a mention of Maven in the URL.

    Recommended Reading: How To Do Podcasts On Android

    Downloading The Tools You Need For Android App Development

    First, you need to create your development environment so that your desktop is ready to support your Android development goals. For that, you will need Android Studio and the Android SDK. Thankfully, these both come packaged together in a single download that you can find here.

    Android Studio is an IDE. That stands for integrated development environment, which is essentially an interface where you can enter your code and access all the different tools necessary for development. Android Studio allows you to access libraries and APIs from the Android SDK, thereby giving you access to native functions of the operating system. Youll also be able to build your app into an APK using Gradle, test it via a virtual device , and debug your code while it runs.

    With all that said, keep in mind that there are other options available for your Android app development. For example, Unity is a very powerful tool for cross-platform game development that also supports Android. Likewise, Visual Studio with Xamarin is an excellent combination for creating cross-platform apps in C#.

    We have a guide on how to create non-game apps in Unity and an introduction to Xamarin for cross platform Android development to help you out!

    Android Studio is the best place for most people to start , particularly as it provides all these additional tools and resources in a single place.

    Fortunately, set up is very simple and you only need to follow along with the instructions on the screen.

    Storage Media And Animations

    Learning Objectives : In this module you will learn most important persistent frameworks in Android system, which is SharedPreference, and Android File System. We will learn to implement different types of animations provided by android system to create impressive android applications.

    Topics : Internal & External File Storage, haredPreference – Creating settings UI using the preferences framework and reacting to changes in a Shared Preferences instance,MediaPlayer & VideoView, Tween Animation, View Property Animation, FrameAnimation

    Read Also: Best Security Camera App For Android

    Writing First Android Studio Application

    As in features of Android Studio, its mentioned that Android Studio provides various numbers of templates by default. It allows you to select them before creating a project. To create a new project click on Create New Project.

    After clicking, another new window pops up to select several predefined templates. Pick what suits the current project needs. If there is no desired template, choose Empty Activityand click on the Nextbutton.

    To find out more on this, refer to Android Studio Main Window

    After clicking on the Next button, another window pops up asking to enter the name of the project, package name, location to save the project, programming language to select, and the minimum SDK API level . After entering the information, click on the Finishbutton.

    Congratulations, the first Android Studio project is ready. Initially, it shows the tip of the day, which gives tips to improve work efficiency. Before going to explore the Android Studio, get familiar with the initial screen which is shown below.

    For a better understanding of the Android Studio environment, it has been divided into 4 parts:

    1. Menu Part: In this section, it provides options to create a new project, open an existing android studio project, a button to run the application, dropdown for selecting the desired device to run and test an application on.

    Android App Development For Beginners

    Android Studio tutorial for beginners

    Seventy-five percent of all phones are Android phones and seventy-five percent of all Internet users only access the Internet using their phone. So there is a big market for Android apps.

    We just published crash course on Android app development on the freeCodeCamp.org YouTube channel. This course is perfect if you are brand new to Android app development.

    Rahul Pandey developed this course. Rahul is an Android Lead at Facebook and a lecturer at Stanford University.

    In this course you will learn Android development by building a tip calculator. This course assumes no prior experience with Android, and by the end you’ll have something an app you could publish.

    You will learn how to create the user interface with XML, and how to code the logic using the Kotlin programming language. These are the fundamental building blocks of any modern Android app.

    You will also learn how to use the ConstraintLayout for the layout and two event listeners for the app logic. After you enter a base amount and a tip percentage, the app will calculate the tip and total for you. You will also implement a tip percentage animation and a footer to make our app more unique.

    Watch the course below or on the freeCodeCamp.org YouTube channel .

    Don’t Miss: Best Budget Android Tablet For Gaming

    Change The Ui Strings

    To preview the UI, click in the toolbar and select Design. Notice that the text input and button label are set to default values.

    Follow these steps to change the UI strings:

  • Open the Project window and then open app > res > values > strings.xml.

    This is a string resources file, where you can specify all of your UI strings. It allows you to manage all of your UI strings in a single location, which makes them easier to find, update, and localize.

  • Click Open editor at the top of the window. This opens theTranslations Editor, which provides a simple interface to add and edit your default strings. It also helps you keep all of your translated strings organized.
  • Figure 7. The dialog to add a new string

    In the Add Key dialog box, complete the following steps:

  • Enter “edit_message” in the Key field.
  • Enter “Enter a message” in the Default Value field.
  • Click OK.
  • Add another key named “button_send” with a value of “Send”.
  • Now you can set these strings for each view. To return to the layout file, clickactivity_main.xml in the tab bar. Then, add the strings as follows:

  • Click the text box in the layout. If the Attributes window isn’t already visible on the right, click Attributes on the right sidebar.
  • Locate the text property, which is currently set to “Name,” and delete the value.
  • Locate the hint property and then click , which is to the right of the text box. In the dialog that appears, double-click edit_message from the list.
  • Where To Go From Here

    With these two basic concepts in mind, you have two options. If you prefer staying in the main documentation, which makes it easy to branch off to other topics to learn more about specific aspects of building an app, you can proceed to the next lesson to build your first app. However, if you like to follow step-by-step tutorials that explain every step from beginning to end, then consider the Android Basics in Kotlin course.

    Don’t Miss: Best Malware Scan For Android

    What Is Android Studio

    Android Studio is the official Integrated Development Environment for Android app development, based on IntelliJIDEA. On top of IntelliJs powerful code editor and developer tools, Android Studio offers even more features that enhance your productivity when building Android apps, such as:

    • A flexible Gradle-based build system
    • A fast and feature-rich emulator
    • A unified environment where you can develop for all Android devices
    • Apply Changes to push code and resource changes to your running app without restarting your app
    • Code templates and GitHub integration to help you build common app features and import sample code
    • Extensive testing tools and frameworks
    • Lint tools to catch performance, usability, version compatibility, and other problems
    • C++ and NDK support
    • Built-in support for , making it easy to integrate Messaging and App Engine

    Now that you know what is Android Studio, lets move further and see how to set up and configure Android Studio on your system to develop Android App.

    Setting up Android Studio

    One of the most convenient factors about Android Studio is that you can start developing Android applications on any of the operating systems. It can be Microsoft Windows, Mac OS or Linux.

    Now to start off with the implementation part, we need to install the following softwares:

  • JDK Java Development Kit

  • Android Studio

  • 1. JDK Installation

    Once you configure JDK, you can go ahead with the Android Installation.

    2. Android Studio

    Share post:

    Popular

    More like this
    Related

    What Is Digital Secure App On Android

    Best Password...

    Sign Documents On Android Phone

    How To...

    How To Create Resume On Android Phone

    Build Free...

    Remote Control Android Phone Over Wifi

    Best Remote...