You are on page 1of 34

Android Studio - Introduction

Michael Pan
Why Android Studio
Most advanced IDE

Google Official support

Current version 0.51


Hi, I am Android Studio
Download
http://developer.android.com/sdk/installing/studio.html
Open & Launch
New Project
Blank Activity
Activity & Layout
Waiting
Overview
Project View
Editor View
Editor Tab - File name
Import folders & files

src/
main/
java/
res/
layout/
values/
AndroidManifest.xml
UI Layout - activity_record.xml
UILayout - Design
Design View Preview Hierarchy

Components

Attributes
Create a new Class - Project Window
Source
Record.java
public class Record {!
String description;!
int type;!
int cost;!
}
How about getter & setter
Android Studio Tool
Record.java
public class Record {!
String description;!
int type;!
int cost;!
!

public String getDescription() {!


return description;!
}!
!

public void setDescription(String description) {!


this.description = description;!
}!
}
Repeat steps on other fields
But how about naming convention
public class Record {!
String mDescription;!
int mType;!
int mCost;!
}
Getter & Setter Not good

public class Record {!


String mDescription;!
int mType;!
int mCost;!
!

public String getmDescription() {!


return mDescription;!
}!
!

public void setmDescription(String mDescription) {!


this.mDescription = mDescription;!
}!
}
Preferences - Code Style -> Java
Code Generation
Generate it again
public class Record {!
String mDescription;!
int mType;!
int mCost;!
!

public String getDescription() {!


return mDescription;!
}!
!

public void setDescription(String description) {!


mDescription = description;!
}!
}
Run the Emulator
Create Emulator first

Reference http://developer-s-note-blog.logdown.com/posts/98744-hello-
android-studio
Start Genymotion
Run the app
Hello World
開發者選項
設定

點擊 Build Number 7 次

出現開發者項⺫⽬目
USB Debugging Enable
Question

You might also like