Application Programming Hend Alkittawi Android Development Introduction to Android Studio and Android Apps Anatomy GRAPHICAL USER INTERFACES (GUIs) - Console app vs. Mobile app! >> Enter employee name: Ryan >> Enter employee title: Product Manager >> Enter hire date: 06-03-2018 Employee Management Employee Name Employee Title ⏬ Employee Hire Date 📅 Submit ANDROID STUDIO - Android Studio is an integrated development environment (IDE) for building Android apps - Download and install Android Studio here - Installing Android Studio includes - Android SDK (Software Development Kit) - Android SDK tools and platform tools (for debugging & testing) - A system image for the Android emulator - JDK HELLO, ANDROID STUDIO! - In Android Studio, create a new project - Select “Phone and Tablet” template → next - Select “Empty Views Activity” (different from “No Activity”) → next - - Package name: edu.utsa.cs3443.projectName → next - Language: Java → next - Minimum SDK: Android 8 (Oreo) - Finish → Finish Android Studio may need to install several things if this is your first project - be patient and do not close the IDE until it is finished! 1 2 3 4 Project tool window Editor tool window HELLO, ANDROID STUDIO! - Layout Editor - drag and drop views in the Design mode - view the xml code by clicking the Code button in the top left HELLO, ANDROID STUDIO! - Resource: a piece of your app that is not code (e.g. image files, audio, XML) - Layout: Defines a set of UI objects and the objects’ positions on the screen - View: UI objects (View is a superclass of all UI components) - Inflate: parse an XML layout resource and convert it to a hierarchy of View objects HELLO, ANDROID STUDIO! - Activity: a class in the Android SDK which represents an entry point to into your app and is responsible for managing user interactions with a screen of information - Name your Activity class: SomeNameActivity.java - Name your layout file: activity_some_name.xml In this example: MainActivity.java and activity_main.xml HELLO, ANDROID STUDIO! - MainActivity.java (default template) - onCreate() is called when an instance of the activity subclass is created - setContentView() assigns this activity the UI it manages; it inflates the layout & puts it on the screen, instantiating all views in the layout file as defined by their attributes package edu.utsa.cs3443.hello_world; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } ANDROID SDK - Immediately after installing Android Studio for the first time it is likely that only the latest released version of the Android SDK has been installed. - To install older versions of the Android SDK simply select the checkboxes corresponding to the versions and click on the Apply button. - This task can be performed by clicking on the More Actions link within the welcome dialog or by clicking the Preferences menu option, then selecting the SDK Manager option from the drop-down menu, - select Android Oreo (8.0) CREATING A VIRTUAL DEVICE - An Android application may be tested by installing and running it either on a physical device or in an Android Virtual Device (AVD) emulator environment. - As part of the standard Android Studio installation, several emulator templates are installed allowing AVDs to be configured for a range of different devices. - New AVDs are created and managed using the Android Virtual Device Manager. - Tools > Device Manager (or the icon) ANDROID DEVELOPMENT RESOURCES ● Our Textbook Forum ○ ● Documentation ○ ● ● https://developer.android.com/ Newsgroups And Forums ○ https://stackoverflow.com/questions/tagged/android ○ https://androidforums.com/ Development Tips ○ ● https://forums.bignerdranch.com/ https://android-developers.googleblog.com/ Videos And Tutorials ○ https://www.youtube.com/user/androiddevelopers CODE DEMO - Create a HelloWorld Android Application using Android Studio and walk through the project content! IMPORTANT Run the HelloWorld Android App on your machine and/or VDI before the end of the week! DO YOU HAVE ANY QUESTIONS? THANK YOU! @ hend.alkittawi@utsa.edu By Appointment Online