Presenter Sudhanshu Gupta

Slides:



Advertisements
Similar presentations
Chapter 1: Introduction. Contents Whats New in Dreamweaver CS4? The Dreamweaver CS4 Interface Setting Up a Site Creating a Web Page Adding Text to Your.
Advertisements

Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Review of last session The Weebly Dashboard The Weebly Dashboard Controls your account and your sites Controls your account and your sites From here you.
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Chapter 4 Code Editor Goals and Objectives Program more efficiently? How can you speed up your development process? Do you want to learn useful shortcuts.
Chapter 3 Navigating a Project Goals & Objectives 1.Get familiar with the navigation of the project. How is everything structured? What settings can you.
| | Tel: | | Computer Training & Personal Development Outlook Express Complete.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 21 Fields and Forms.
Basic Android Tutorial USF’s Association for Computing Machinery.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Android Programming By Mohsen Biglari Android Programming, Part2: Android Studio, A Closer Look 1 Part2: Android Studio, A Closer Look By Mohsen Biglari.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Productivity Programs Common Features and Commands.
MICROSOFT WORD 2007 INTRODUCTION 1. Changing Views Click VIEW tab on ribbon –Print Layout (default) Shows document as if printed –Full Screen Reading.
First Venture into the Android World Chapter 1 Part 2.
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
Creating and Editing a Web Page
Intoduction to Andriod studio Environment With a hello world program.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Chapter 5 Using a Template to Create a Resume and Sharing a Finished Document Microsoft Word 2013.
CHAPTER 1 part 1 Introduction. Chapter objectives: Understand Android Learn the differences between Java and Android Java Examine the Android project.
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Dive Into® Visual Basic 2010 Express
Jeopardy Word-1 Word-2 Word-3 Word-4 Word-5 Q $100 Q $100 Q $100
Excel Tutorial 8 Developing an Excel Application
Word Lesson 1 STUDY GUIDE.
June 17, 2009 Office 2007 Tips & Tricks.
Computer Literacy BASICS
Working with Data Blocks and Frames
Chapter 2: The Visual Studio .NET Development Environment
User Profiles and Workspaces
Working in the Forms Developer Environment
Obtaining the Required Tools
DRAWING LINES To draw lines click View in the Main Menu Toolbar -> Toolbars and check the Editor option. The Editor toolbar will appear amongst the toobars.
Chapter 2 Starting a Project
Android Studio, Android System Basics and Git
Microsoft Word 2010.
MAD.
Planning and Building a Presentation
1. Introduction to Visual Basic
Introduction to the Visual C# 2005 Express Edition IDE
Comprehend. Create. Communicate. Achieve More.
Android SDK & App Development
Upgrading To PowerPoint 2007.
© Paradigm Publishing, Inc.
Some Tips for Using Eclipse
Chapter 2 Adding Web Pages, Links, and Images
Assistant lecturer Nisreen A. Jabr
Chapter 2 – Introduction to the Visual Studio .NET IDE
Word 2007 Basics TCC July 2011.
Android Developer Fundamentals V2 Lesson 1
Productivity Programs Common Features and Commands
Microsoft PowerPoint 2007 – Unit 2
Using Templates and Library Items
Android Application Development
Autodesk Inventor Tips and Tricks for New Users
Word 2007 – Tips and Techniques
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
HIBBs is a program of the Global Health Informatics Partnership Learning the Basics of Microsoft Word 2019 and Microsoft office support TFN
Welcome To Microsoft Word 2016
Presentation transcript:

Presenter Sudhanshu Gupta Android Unleashed Android App Development Course Class 2 – Introduction to Android Studio, ADB , AVD & First “Hello Android” App Presenter Sudhanshu Gupta www.softwaresunleashed.com softwares.unleashed@gmail.com

Table Of Contents Creating a New Project & Getting familiar with Android Studio Introduction & Installation of ADB. Understanding & Setting-up AVD. Deploying your first “Hello Android” App to Android Device via ADB. Exercise Hands-on session on:: Installation of ADB. Configuring AVD. Pushing first Android App to Device.

Creating a New Project In our last class, We are done with Installation of Android Studio and are now ready to Develop our First- Hello Android App. Double click the Android Studio shortcut to open the Welcome Screen , and click “Start A New Android Studio Project”. (Refer to Images)

Creating a New Project In the second dialog that appears, configure your project. Application Name : HelloAndroid (No Spaces) Company Domain : android.unleashed.com Project Location : c:\AndroidCourseProjects\HelloAndroid (Or as per your choice)

Creating a New Project Select the SDK version running on our device or for which we wish to develop the application. Select API 19: Android 4.4 (Kitkat) for our project. Minimum SDK dropdown provides options to develop for other SDK versions (which were installed during Android Studio configuration). Refer to image.

Creating a New Project Select the type of “Launcher Activity”. Let it be Blank Activity for now. Activity acts as a canvas where you draw your controls (Views / Buttons / Layouts). Click Next.

Creating a New Project Enter the Title of this Activity. “My First Hello Android App”. Click Finish.

Creating a New Project Once Finish is clicked, Android Studio performs few background tasks for you, to configure the new project. Wait till these background operations finish.

Creating a New Project

Getting Familiar with Android Studio Congratulations!!! We just created our first Android Studio project & now we want to start programming. But, Lets first get familiar with the navigation of the project. We now discuss the Structure of a Project in Android Studio. We will start by understanding the Project Navigation Panel.

Getting Familiar with Android Studio

Getting Familiar with Android Studio Project Navigation Panel Android view (Default) Shows the most important source directories Groups the build files for all modules in a common folder. Groups all the manifest files for each module in a common folder. Groups resource files for different locales, orientations, and screen types in a single group per resource type. Project view Shows the directory structure of the project. Package view Shows only the package structure. (Packages & Classes)

Getting Familiar with Android Studio Project Structure (Important files / elements) build/ -- contains compiled resources after compiling application. Also contains files generated by compiler such as R.java (\HelloAndroid\app\build\generated\source\r\debug\com\unleashed\android\helloandroid \R.java) , which contains references to application resources. libs/ -- contains the libraries referenced from our code. src/main/ -- contains the source code of the application. src/main/java/ -- contains Java classes organized in packages. Each class is part of project package namespace. (ie. com.unleashed.android.helloandroid) src/main/res/ -- contains project resources. E.g. XML files that specify Layouts, Menu, or Image files. src/main/res/drawable/ -- contains images used in our application. Images for different screen densities, are stored in different folders. (e.g. HDPI, MDPI, XHDPI, XXHDPI). src/main/res/layout/ -- contains XML definition of the views and their elements. These layout files are used to draw views (Buttons, TextView, etc) on the Activity. src/main/res/menu/ -- contains XML definition of the Menus used in the application. src/main/res/values/ -- contains XML files that define name-value pairs. E.g. colors, strings, styles. (dimens.xml, strings.xml, styles.xml) AndroidManifest.xml – Declares basic information required by Android System to run the application. E.g. Pakage Name, Version , Activities, Permissions , Intents, Required HW. build.gradle – script file used to build our project.

Getting Familiar with Android Studio Changing Project Properties There are two dialog boxes that contain project settings (Available in toolbar too). File  Settings & File  Project Structure Important Options (File Settings) : Editor -> Code Style : configure code styles as per your taste. (Tab indents, Font etc) Encoding : IDE’s Encoding. Default is UTF-8 Gradle : Gradle configurations. Gradle is a tool to build and manage Java Projects. Important Options (File Project Structure) : Project : We can change Project Name & Project SDK. We can change SDK for only this project. Modules : Lists the existing modules available in the project. E.g. “app”. We can modify their respective properties. File Settings File Project Structure

Getting Familiar with Android Studio Code Editor Settings – Remember to check these options if not already selected. Open the editor settings navigate to File | Settings, section Editor  General | Mouse (Allows to change the font size of the editor using the mouse wheel) Open the editor settings navigate to File | Settings, section Editor  General | Other (When we move the mouse over a piece of code and wait 500 ms, a quick doc about that code will be displayed in a small dialog.)

Getting Familiar with Android Studio More Code Editor Settings – Remember to check these options if not already selected. Smart Keys : Open the editor settings navigate to File | Settings, section Editor  General | Smart Keys (Configures Closing braces, quotes, XML tags, indenting lines when “Enter” key is pressed.) Appearance : Open the editor settings navigate to File | Settings, section Editor  General | Appearance (Select the options highlighted , to enable Line Numbers in editor and Method / Function separator.)

Getting Familiar with Android Studio More Code Editor Settings – Remember to check these options if not already selected. Colors & Fonts : Open the editor settings navigate to File | Settings, section Editor  Colors & Fonts (Changes the fonts and colors. There are a lot of options and elements to configure (keywords, numbers, warnings, errors, comments, strings, and so on). Editor Tabs: Open the editor settings navigate to File | Settings, section Editor  General | Editor Tabs (Select - select the Mark modified tabs with asterisk option to easily detect the modified and not-saved files)

Getting Familiar with Android Studio More Code Editor Settings – Remember to check these options if not already selected. Code Folding : Open the editor settings navigate to File | Settings, section Editor  General | Code Folding (It is very useful to hide code blocks that we are not editing, simplifying the code view. We can collapse or expand the blocks using the icons from the editor). Auto Import : Open the editor settings navigate to File | Settings, Editor  General | Auto Import (Configures how the editor behaves when we paste code that uses classes that are not imported in the current class. By default when we do this, a pop up appears to add the import command.)

Getting Familiar with Android Studio Code Completion (Ctrl + Spacebar) Android Studio displays a list of suggestions while typing the code. If “Code Completion” suggestions are not displayed, it can be opened by pressing Ctrl + Spacebar key combo. Keep typing, Select command from the list, press ENTER key, or Double-click to add it in your code. If you are typing an expression (say if(bool_value)) , select bool_value , and press “!” key to insert a negated expression. Ie. If( ! bool_value).

Getting Familiar with Android Studio Smart Type Code Completion (Ctrl + Shift + Spacebar) Normal Code Completion – All variables starting with “o” are displayed. Smart Type Code Completion – Only expected datatype of method Log.i(String) are displayed.

Getting Familiar with Android Studio Completion of Statements (Ctrl + Shift + Enter) Android Studio allows for auto-complete of a statement segment. Type any statement  if , while , for , do Press Ctrl + Shift + Enter to complete the statement block , ie parenthesis & open-close braces. This technique can also be used to complete Methods (Function) declarations. Start typing a method and after typing the opening parenthesis, or after typing the method parameters, press Ctrl + Shift + Enter. The closing parenthesis and the brackets are added to complete the method specification. Ctrl + Shift + Enter Ctrl + Shift + Enter

Getting Familiar with Android Studio Automatic Code Generation (Alt + Insert) Android Studio can be used to generate constructors, getters, and setters methods, equals and toString methods, override or delegate methods. After Pressing Alt + Insert

Getting Familiar with Android Studio Inserting Code Templates ( Ctrl + J ) Goto menu Code  Insert Live Templates (Different Menu pops-up depending upon the placement of cursor) Android Studio provides means to insert ‘Templates’ : To iterate between : Collections, Arrays, Linked Lists. Code to print formatted strings. Code to Throw Exceptions. Code to add Static / Final variables. The left edge of the dialog, each template has a prefix, so if you type the prefix in the editor and press the Tab key, the code template is added automatically. Inside Function In Class Scope (Outside Function)

Getting Familiar with Android Studio Navigating Code – Method 1 – Ctrl + Click on Symbol Most direct way to navigate to declarations or type declarations is to press Ctrl and click on the symbol when it is displayed as a link. Navigate | Declaration

Getting Familiar with Android Studio Navigating Code – Method 2 -- Icons From the left edge of the editor we can navigate through the hierarchy of methods. Next to the method declarations that belong to a hierarchy of methods, there is an icon that indicates if a method is: Implementing an Interface method, Implementing an Abstract class method, Overriding a Superclass method, Or if a method is Implemented / Overridden by other descendants. Click on these icons to navigate to the methods in the hierarchy. Navigate | Super Method or Navigate | Implementation(s) Test it by opening the main activity of our first project (MainActivity.java).

Getting Familiar with Android Studio Navigating Code – Method 3 – Using Custom Regions Custom Region is just a piece of code that you want to group and give a name to. E.g., if there is a class with a lot of methods, we can create some custom regions to distribute the methods among them. Select the fragment of code, navigate to Code | Surround With, and select one of these two options: <editor-fold…> Comments Region…endregion Comments Both of them create a region but using a different style. We can navigate them using the Navigate | Custom Folding menu.

Getting Familiar with Android Studio Navigate menu Lets spend some time discussing various options under this category Class/File/Symbol: Finds a Class (Ctrl+N), a File, Symbol (Ctrl+Shift+N) by its name. Line: Goes to a line code by its number.

Getting Familiar with Android Studio Navigate menu File Structure (Ctrl + F12) Opens a dialog box, displaying the list of methods, the icons that indicate the type of element, or the icons that indicate the visibility of the element. Type Hierarchy (Ctrl + H) : Opens a dialog that shows the type hierarchy of the selected object. Method Hierarchy (Ctrl + Shift + H) : Opens a dialog that shows the method hierarchy of the selected method. Call Hierarchy (Ctrl + Alt + H) : Opens a dialog that shows the call hierarchy of the selected method. Next Method (Ctrl + Down) : Navigates to the next method. Previous Method (Ctrl + Up) : Navigates to the previous method.

Android Studio – Tips & Tricks When in Doubt, place the cursor in the area of interest (basically the code section), and press Alt+Enter, to see the various options. Depending on the context (ie. Placement of the cursor) , appropriate options are displayed for user to use. Ctrl + / : Comments each line of the selected code. Ctrl + Shift + / : To use block comments Ctrl + Alt + I : Indents the selected code. Useful when you finish writing a block of code or method to clean it up. Ctrl + Alt + O : Optimizes the imports, removing the unused ones and reordering the rest of them. And Of course the Regular(s) – Ctrl + F : Finds a string in the active tab of the editor. Ctrl + R : Replaces a string in the active tab of the editor. Ctrl + A : Selects all the code of the opened file.

Getting Familiar with Android Studio Graphical Editor

Introduction & Installation of ADB ADB – Android Debug Bridge

Understanding & Setting-up AVD AVD – Android Virtual Device

Deploying your first “Hello Android” App to Android Device via ADB Time has come to get our hands dirty…

Workout (Exercise) Time Students are expected to finish the following task-items, before the next class: Hands-on session on:: Check Installation of ADB on their machines. Creating a New AVD (Android Virtual Device / Simulator). Develop and compile first “Hello Android” app. Pushing first Android App to their Android Device (Phone / Tablet). Play around a bit with Android Studio IDE to get a better feel of the tool. Surf through code files (Hello Android) and try to tweak code and see the effect on final APK.

References for further reading [Book] Android Studio Application Development – Belen Cruz Zapata Action Bars -- http://developer.android.com/guide/topics/ui/actionbar.html