Basic android 1
-
Upload
kingkan-banyenngam -
Category
Technology
-
view
135 -
download
0
description
Transcript of Basic android 1
Basic Android #1Build your simple app
Thursday, August 8, 13
Build Simple App
download android sdk
create your first app
http://developer.android.com/sdk/index.html#mac-bundle
Step 1
Thursday, August 8, 13
Structure of project
src
assets
libs
res *
AndroidManifest.xml
Thursday, August 8, 13
Drawable
xhdpi 2.0
hdpi 1.5
mdpi 1.0
ldpi 0.75
This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
ref:http://developer.android.com/training/basics/supporting-devices/screens.html
Nexus 7
true tab3g
Thursday, August 8, 13
AndroidManifest.xmlเวลาอัพขึ้น market ต้องมากขึ้นเรื่อยๆ
แสดง icon ของApp
Activity นี้จะแสดงแต่แนวตั้ง
Thursday, August 8, 13
Life Cycle Activity
Thursday, August 8, 13
Thursday, August 8, 13
Activity?
จะมีแต ่view เดี่ยวๆโปรแกรมทํางานไม่ได้ if it has a UI, it’ll have at least one Activity
Relationship between an Activity with a UI screen ---> MVC paradigm (ref: Android in action )
Thursday, August 8, 13
A
B
A
ActivityIntent intent = new Intent(this, A.class);startActivity(intent);
Intent intent = new Intent(this, B.class);startActivity(intent);
Intent intent = new Intent(this, A.class);startActivity(intent);
ถ้ากดBack สองที ?
show A1
show B1
show A
Thursday, August 8, 13
setcontentView(R.layout.list_item_icom);ImageView imgIcon = (ImageView)findViewById(R.id.icon);
Thursday, August 8, 13
LayoutLinearLayout RelativeLayout
Thursday, August 8, 13
• Measure: 0.977ms• Layout: 0.167ms• Draw: 2.717ms
The timings for rendering a complete list item using this layout are:
• Measure: 0.598ms• Layout: 0.110ms• Draw: 2.146ms
http://developer.android.com/training/improving-layouts/optimizing-layout.html
Thursday, August 8, 13
Most of this time difference is due to the use of layout_weight in the LinearLayout design,
which can slow down the speed of measurement
http://developer.android.com/training/improving-layouts/optimizing-layout.html
Thursday, August 8, 13
Thank you for your Attention
Thursday, August 8, 13