Download 02. For the first time to create an Android application

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Construction management wikipedia , lookup

PRINCE2 wikipedia , lookup

Transcript
02. For the first time
to create
an Android application
DKU-MUST Mobile ICT Education Center
Goal
• Learn how to create basic Android application.
• Learn the name of the AVD.
• Determine the configuration of the Android project.
Page  2
1. First create a Hello Android program
Android project creation
Display design and editing
(*.xml)
Creating & modifying the JAVA code
(*.java)
Project execution and results
(AVD)
Normal
operation
Android application development
is complete
Page  3
1. First create a Hello Android program
The first application written(1/7)
 Eclipse Menu [File]-[New]-[Project]
 [New Project] - [Android] - [Android Application Project]
Page  4
1. First create a Hello Android program
The first application written (2/7)
 [New Android Application] Setting
Android 4.1 , API 16
or
Android 2.3.3, API 10
Page  5
1. First create a Hello Android program
The first application written (3/7)
 [Configuration Launcher Icon] is default
 [Create Activity] is default
 [New Blank Activity] Setting
Page  6
1. First create a Hello Android program
The first application written (4/7)
 Screen Design and XML code
Page  7
1. First create a Hello Android program
The first application written (5/7)
 Java Code
Page  8
1. First create a Hello Android program
The first application written (6/7)
 Project Execution
Page  9
1. First create a Hello Android program
The first application written (7/7)
 The results of running
Page  10
1. First create a Hello Android program
[Directly released 2-1]
 Build and run a new project, "HiAndroid“
 Screen looks suitably decorated
Page  11
1. First create a Hello Android program
 Workaround when the project does not recognize the AVD
1. Run the project again.
2. Try running again, after shutting down the AVD
3. AVD to delete and re-create a look
4. Gingerbread (2.3.3) to develop
Page  12
1. First create a Hello Android program
 (Consultation)
AVD kinds of error messages and how to resolve
▶ You may want to manually restart adb from the Devices view.
 Run the project again
▶ emulator-5554 disconnected! Cancelling '패키지이름.액티비티이름 activity launch‘!
 Run the project again after closing all AVD
▶ could not get wglGetExtensionsStringARB
 Warning level. You can ignore
▶ Launch Cancelled
 AVD just leave, Run the project again
▶ AVD는 가동 되고, Starting activity 패키지이름.액티비티이름 on device emulator-
5554 에서 한동안 멈춘 상태
 AVD를 그냥 두고, 다시 프로젝트를 실행
Page  13
2. AVD name and usage ▶ AVD Name
Page  14
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (1/7)
 Initial screen and horizontal screen
Ctrl + F11
Page  15
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (2/7)
 Add Alarm / Virtual Camera / Gallery
Page  16
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (3/7)
 Web Browser
Page  17
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (4/7)
 Change the Wallpaper
Page  18
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (5/7)
 Changing the Display Settings
Page  19
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (6/7)
 Application on the desktop, copy, and delete
Page  20
2. AVD name and usage ▶ AVD Usage
AVD Learn to Use (7/7)
 Completely delete the application
Page  21
3. Complete application written
▶ Eclipse project management
Android Project Management(1/4)
 Project close-to-open / Project to remove
Page  22
3. Complete application written
▶ Eclipse project management
Android Project Management(2/4)
 Reload removed project (Menu [File] – [Import])
Page  23
3. Complete application written
▶ Eclipse project management
Android Project Management(3/4)
 Export Project (Menu [File] – [Export])
Page  24
3. Complete application written
▶ Eclipse project management
Android Project Management(4/4)
 Import the exported project (Menu [File] – [Import])
Page  25
3. Complete application written
▶ Eclipse project management
[Directly released 2-2]
1. Create one new project
2. Export Project
3. Destroying the project
4. And, Let's bring back
Page  26
3. Complete application written
▶ Standard framework of the project
 This project to determine the details
• Eclipse usage and auto-completion
• XML grammar for Screen configuration
• How to coding Java code
 approach of the contained widget
in the main.xml file
 Write a code to operate
in the event of the widget
• R.java of contents
Page  27
3. Complete application written
▶ Standard framework of the project
To create a basic application(1/11)
 Application information entered
Project Name
Application Name
Package Name
(com.cookandroid.project name)
App version of the SDK,
App that runs a minimum SDK version
Page  28
3. Complete application written
▶ Standard framework of the project
To create a basic application(2/11)
 Activity information entered Activity Name
 Project Name+Activity Will be fixed
Main layout XML name
 will be fixed to the main
App Title  Project Name
Page  29
3. Complete application written
▶ Standard framework of the project
To create a basic application(3/11)
 Screen design
LinearLayout by default in the future will use
Page  30
3. Complete application written
▶ Standard framework of the project
To create a basic application(4/11)
 On the Add button and main.xml
Page  31
3. Complete application written
▶ Standard framework of the project
To create a basic application(5/11)
 string.xml Compilation
Page  32
3. Complete application written
▶ Standard framework of the project
To create a basic application(6/11)
 BaseAppActivity.java Coding (1)
Delete
Page  33
3. Complete application written
▶ Standard framework of the project
To create a basic application(7/11)
 BaseAppActivity.java Coding (2)
Ctrl + shift + O
is pressed Removed
Page  34
3. Complete application written
▶ Standard framework of the project
To create a basic application(8/11)
 BaseAppActivity.java coding (3)
Ctrl+Shift+O is pressed Added
Page  35
3. Complete application written
▶ Standard framework of the project
To create a basic application(9/11)
 BaseAppActivity.java coding (4)
Code of AutoComplete
Page  36
3. Complete application written
▶ Standard framework of the project
To create a basic application(10/11)
 BaseAppActivity.java coding (5)
Autocomplete code
Page  37
3. Complete application written
▶ Standard framework of the project
To create a basic application(11/11)
 BaseAppActivity.java coding (6) – final code, results of running
Page  38
3. Complete application written
▶ Standard framework of the project
 Event occurs coding of the widget
 Good chant are often used
Sequence of actions
when an event occurs on the widget
Widget variable declaration
Main.xml file widget id
to a variable assignment
At the time of the event defined
in the widget class which acts
Page  39
An example of when the button is clicked
Button button1;
Button1 = (Button)findViewById(R.id.btn1);
Button1.setOnClickListener(new View.OnClickLister(){
public voidonClick(View v) {
// In this section,
when you click a button, putting the code to work
}
});
3. Complete application written
▶ Eclipse project management
Directly released 2-3
 Created four buttons as shown in the figure.
 Required work when you click each button written project
FourButton.
 Change the color of each button is a different color
Page  40
4. Project configuration▶ BaseApp Project
Page  41
DKU-MUST Mobile ICT Education Center