Top Banner
Android Studio - Introduction Michael Pan
34

Introduction to Android Studio

May 10, 2015

Download

Technology

Michael Pan

Michael's Android Lesson
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to Android Studio

Android Studio - IntroductionMichael Pan

Page 2: Introduction to Android Studio

Why Android StudioMost advanced IDE

Google Official support

Current version 0.51Hi, I am Android Studio

Page 3: Introduction to Android Studio

Downloadhttp://developer.android.com/sdk/installing/studio.html

Page 4: Introduction to Android Studio

Open & Launch

Page 5: Introduction to Android Studio

New Project

Page 6: Introduction to Android Studio

Blank Activity

Page 7: Introduction to Android Studio

Activity & Layout

Page 8: Introduction to Android Studio

Waiting

Page 9: Introduction to Android Studio

Overview

Page 10: Introduction to Android Studio

Project View

Page 11: Introduction to Android Studio

Editor View

Page 12: Introduction to Android Studio

Editor Tab - File name

Page 13: Introduction to Android Studio

Import folders & files

src/ main/ java/ res/ layout/ values/ AndroidManifest.xml

Page 14: Introduction to Android Studio

UI Layout - activity_record.xml

Page 15: Introduction to Android Studio

UILayout - Design

Page 16: Introduction to Android Studio

Design View

Components

Preview Hierarchy

Attributes

Page 17: Introduction to Android Studio

Create a new Class - Project Window

Page 18: Introduction to Android Studio

Source

Page 19: Introduction to Android Studio

Record.javapublic class Record {! String description;! int type;! int cost;!}

Page 20: Introduction to Android Studio

How about getter & setterAndroid Studio Tool

Page 21: Introduction to Android Studio

Record.javapublic class Record {! String description;! int type;! int cost;!!

public String getDescription() {! return description;! }!!

public void setDescription(String description) {! this.description = description;! }!}

Page 22: Introduction to Android Studio

Repeat steps on other fields

Page 23: Introduction to Android Studio

But how about naming conventionpublic class Record {! String mDescription;! int mType;! int mCost;!}

Page 24: Introduction to Android Studio

Getter & Setter public class Record {! String mDescription;! int mType;! int mCost;!!

public String getmDescription() {! return mDescription;! }!!

public void setmDescription(String mDescription) {! this.mDescription = mDescription;! }!}

Not good

Page 25: Introduction to Android Studio

Preferences - Code Style -> Java

Page 26: Introduction to Android Studio

Code Generation

Page 27: Introduction to Android Studio

Generate it againpublic class Record {! String mDescription;! int mType;! int mCost;!!

public String getDescription() {! return mDescription;! }!!

public void setDescription(String description) {! mDescription = description;! }!}

Page 28: Introduction to Android Studio

Run the EmulatorCreate Emulator first

Reference http://developer-s-note-blog.logdown.com/posts/98744-hello-android-studio

Page 29: Introduction to Android Studio

Start Genymotion

Page 30: Introduction to Android Studio

Run the app

Page 31: Introduction to Android Studio

Hello World

Page 32: Introduction to Android Studio

開發者選項設定

點擊 Build Number 7 次

出現開發者項⺫⽬目

Page 33: Introduction to Android Studio

USB Debugging Enable

Page 34: Introduction to Android Studio

Question