A ppendix
1 2010 5 21 SDK 2.2. 2.1 SDK. DevGuide SDK. 2.2 Frozen Yoghurt Froyo. Donut, Cupcake, Eclair 1. Froyo (Ginger Bread) 2010. Froyo Eclair 0.1.. 2.2. UI,... 2.2. PC 850
CPU Froyo......... 2. 2.1. 1. SR2 3.5. JDK 6 Update18 20 JDK.. SDK. SDK Appendix 851
... SDK ADT. 2.1 0.9.5 2.2 0.9.7. Help/Install New software Work with https://dlssl.google.com/android/eclipse/.. ADT DDMS 0.9.7. [Next]... ADT ADT. SDK. Windows/Android SDK and AVD Manager Available Packages.. 2.1. 852
. SDK Tools 6 SDK API 8,,, Google API 8. Usb Driver package.. Install Selected]. Accept All Install].. ADB ADB. SDK. SDK AVD. Appendix 853
. Virtual Devices New]. scv8 Level 8 Android 2.2 Google APIs. SD 32. Create AVD] AVD. Start].. 2.2 SDK. 854
.. 6..,,. 5.. ID. 52 AVD. 3 SDK, SDK.. File/New/Android Project. Appendix 855
FroyoTest Android 2.2. Min SDK Version 8. Properties,, Finish]... fill_parent 2.2 match_parent fill_parent.. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>. 856
. oncreate. ProyoTest.java package exam.froyotest; import android.app.activity; import android.os.bundle; public class FroyoTest extends Activity { /** Called when the activity is first created. */ @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } }. Run/Run +., +... main.xml. match_parent. Appendix 857
<TextView android:layout_height="wrap_content" />. xml + Run] xml main.out.xml java.. +... AndroidExamAll.zip Import. 8 7.. 858
SDK. 8. 4 SD.. 16G 4...... 2.2. 2.2. installlocation. Appendix 859
ExternalInstall.java public class ExternalInstall extends Activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } } public boolean ontouchevent(motionevent event) { super.ontouchevent(event); if (event.getaction() == MotionEvent.ACTION_DOWN) { Toast.makeText(this,"Touch Event Received", Toast.LENGTH_SHORT).show(); return true; } return false; } 860
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="exam.externalinstall" android:versioncode="1" android:versionname="1.0"> preferexternal.. Settings/Applications/Manage applications ExternalInstall.. Move to phone.. DDMS. Moving Move to SD card. Appendix 861
. FroyoTest. Move to SD card.,. 2.1 installlocation.. SDK (minsdkversion) 8. 8 SDK. 2.2.. 2.2 2.1. 2.2 2.1.., SD. MP3 862
. SD SD. SD. SD.. PC USB. D D.... SD SD.. SD...,... Galaxy S 2G 16G. SD,. SD. Appendix 863
5 PC......... (cloud storage).... /... 864
. application backupagent. restoreanyversion false. true. <application android:label="myapplication" android:backupagent="mybackupagent"> datachanged... bmgr. requestrestore... Appendix 865
DevGuide Backup and Restore...... WiFi. 6. SoundPool. MediaPlayer CPU... SoundPool ID,. SoundPool. 866
pause, resume /... LoadComplete.java public class LoadComplete extends Activity { SoundPool pool; int stream; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); pool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); } findviewbyid(r.id.load1).setonclicklistener(mclicklistener); findviewbyid(r.id.load2).setonclicklistener(mclicklistener); findviewbyid(r.id.pause).setonclicklistener(mclicklistener); findviewbyid(r.id.resume).setonclicklistener(mclicklistener); SoundPool.OnLoadCompleteListener mlistener = new SoundPool.OnLoadCompleteListener() { public void onloadcomplete(soundpool soundpool, int sampleid, int status) { if (status == 0) { stream = soundpool.play(sampleid, 1, 1, 0, 0, 1); } } }; Button.OnClickListener mclicklistener = new Button.OnClickListener() { public void onclick(view v) { MediaPlayer player; switch (v.getid()) { case R.id.load1: int song = pool.load(loadcomplete.this, R.raw.goodtime, 1); pool.play(song, 1, 1, 0, 0, 1); Appendix 867
} }; } break; case R.id.load2: pool.setonloadcompletelistener(mlistener); pool.load(loadcomplete.this, R.raw.goodtime, 1); break; case R.id.pause: //pool.pause(stream); pool.autopause(); break; case R.id.resume: //pool.resume(stream); pool.autoresume(); break; } 4 raw... play... oncreate.. 868
pause, resume.. MediaRecorder,.. YouTube.. 2.2. 3D OpenGL ES 2.0. ImageForma YUV API. 7 fill_parent match_parent. fill_parent., fill. fill_parent fill match. Appendix 869
fill_parent. fill_parent match_parent -1. fill_parent. 2.2 match_parent. 2.2.. <application> vmsafemode. ApplicationInfo FLAG_VM_SAFE_MODE. true JIT. JIT.... API,,. GPS Exif.. API API. API. 870
.... WiFi. 8. (Ththering)... PC PC. PC... 2.2. UI Mode.. Appendix 871