2012/09/26

android app的程式檔案特性與敘述


AndroidManifest.xml
The manifest file describes the fundamental characteristics of the app and defines each of its components. You'll learn about various declarations in this file as you read more training classes.
manifest file敘述了app的基本特性並定義每一個元件。
src/
Directory for your app's main source files. By default, it includes an Activity class that runs when your app is launched using the app icon.
該資料夾有app的主要來源檔案。預設下,包含了當app透過icon被執行所需要的 Activity 宣告。
res/
Contains several sub-directories for app resources. Here are just a few:
包含了一些app resources的子資料夾. 如下
drawable-hdpi/
Directory for drawable objects (such as bitmaps) that are designed for high-density (hdpi) screens. Other drawable directories contain assets designed for other screen densities.
layout/
Directory for files that define your app's user interface.
定義app的使用者介面。
values/
Directory for other various XML files that contain a collection of resources, such as string and color definitions.
該資料夾針對不同的XML檔案( 包含了資源的聚集,比如string, 顏色的定義),
When you build and run the default Android app, the default Activity class starts and loads a layout file that says "Hello World." The result is nothing exciting, but it's important that you understand how to run your app before you start developing.
當建立和執行預設的 Android app,預設的Activity class 會開始讀取一個 layout 檔( 輸出 Hello World.)。
結果或許沒那麼令人興奮,但這對於了解程式開發是很重要的。


資料來源
http://developer.android.com/training/basics/firstapp/running-app.html

2012/09/20

AVD - android虛擬機的 SD Card,上傳下載檔案


android 虛擬機的SD Card位置在
%ANDROID_SDK_HOME%\.android\avd\"android虛擬機名稱資料夾"\sdcard.img

adb指行路徑
C:\Users\user\AppData\Local\Android\android-sdk\platform-tools


  • 上傳檔案


進入命令提示字元,並到 android虛擬機 的資料夾。
%ANDROID_SDK_HOME%\.android\avd\2.3.3.avd>adb push d:\android-test\pic.jpg /sdcard/pic.jpg
63 KB/s (606196 bytes in 9.369s)

%ANDROID_SDK_HOME%\.android\avd\2.3.3.avd>adb shell      #進入 android虛擬機的console畫面
# cd sdcard
# pwd
pwd
/mnt/sdcard
# ls
ls
LOST.DIR
Android
sd
DCIM
pic.jpg                                #可以看到上傳上來的pic.jpg
# exit
exit

d:\My Documents\user\.android\avd\2.3.3.avd>


  • 下載檔案


%ANDROID_SDK_HOME%\.android\avd\2.3.3.avd>adb pull /sdcard/pic.jpg .     #將pic.jpg下載到現行的目錄
58 KB/s (606196 bytes in 10.147s)

d:\My Documents\user\.android\avd\2.3.3.avd>dir pic.jpg
 磁碟區 D 中的磁碟是 新增磁碟區
 磁碟區序號:  284B-45B5

 d:\My Documents\user\.android\avd\2.3.3.avd 的目錄

2012/09/20  下午 02:43           606,196 pic.jpg
               1 個檔案         606,196 位元組
               0 個目錄  293,739,872,256 位元組可用

d:\My Documents\user\.android\avd\2.3.3.avd>





2012/09/19

AVD - 如何安裝 .apk 檔到 android虛擬機


將要安裝的apk檔放到如下位置:
C:\Users\user\AppData\Local\Android\android-sdk\platform-tools\

執行如下指令:
C:\Users\user\AppData\Local\Android\android-sdk\platform-tools\adb -s emulator-"執行序號" install filename.apk      #指定安裝到特定的VM

ex :
d:\Android_Developments>adb -s emulator-5554 install test.apk
74 KB/s (76025 bytes in 0.999s)
        pkg: /data/local/tmp/test.apk
Success

執行序號如下圖紅框的數字。


======================================================
adb執行檔的路經,事先我已設定到環境變數的path。
所以我可以直接在 apk檔的位置直接安裝。
這樣可以省去 apk 搬來搬去的麻煩。

AVD - 快速更改 android虛擬機的螢幕


#emulator -avd "vm-name" -skin WVGA854
執行後,會VM會自動開啟一個新的,並套用新的skin。

-skin 參數可以參考如下的內容
http://maksim28.blogspot.tw/2012/09/avd-id.html

AVD - id 與系統版本的對應平台


可以透過指令來確認  #android list target 可以顯示id 相對應的版本平台.
依經驗,不同的SDK對應會略有不同,所以可以透過指令來確認。

C:\Users\user\AppData\Local\Android\android-sdk\tools>android list targets
Available Android targets:
----------
id: 1 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
     ABIs : armeabi
----------
id: 2 or "Google Inc.:Google APIs:8"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 2
     Description: Android + Google APIs
     Based on Android 2.2 (API level 8)
     Libraries:
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: WVGA854, WQVGA400, HVGA, WQVGA432, WVGA800 (default), QVGA
     ABIs : armeabi
----------
id: 3 or "KYOCERA Corporation:DTS Add-On:8"
     Name: DTS Add-On
     Type: Add-On
     Vendor: KYOCERA Corporation
     Revision: 1
     Description: DTS Add-On
     Based on Android 2.2 (API level 8)
     Libraries:
      * com.kyocera.dualscreen (dualscreen.jar)
          Dual Screen optional platform library
     Skins: DTS400 (default), WVGA854, WQVGA400, HVGA, DTS800, WQVGA432, WVGA800, QVGA
     ABIs : armeabi
----------
id: 4 or "LGE:Real3D Add-On:8"
     Name: Real3D Add-On
     Type: Add-On
     Vendor: LGE
     Revision: 1
     Description: Real3D add-on
     Based on Android 2.2 (API level 8)
     Libraries:
      * com.lge.real3d (real3d.jar)
          Real3D library
     Skins: WVGA854, WQVGA400, Optimus3D (default), HVGA, WQVGA432, WVGA800, QVGA
     ABIs : armeabi
----------
id: 5 or "Samsung Electronics Co., Ltd.:GALAXY Tab Addon:8"
     Name: GALAXY Tab Addon
     Type: Add-On
     Vendor: Samsung Electronics Co., Ltd.
     Revision: 1
     Based on Android 2.2 (API level 8)
     Skins: WVGA854, WQVGA400, GALAXY Tab (default), HVGA, WQVGA432, WVGA800, QVGA
     ABIs : armeabi
----------
id: 6 or "android-10"
     Name: Android 2.3.3
     Type: Platform
     API level: 10
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
     ABIs : armeabi
----------
id: 7 or "Google Inc.:Google APIs:10"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 2
     Description: Android + Google APIs
     Based on Android 2.3.3 (API level 10)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: WVGA854, WQVGA400, HVGA, WQVGA432, WVGA800 (default), QVGA
     ABIs : armeabi
----------
id: 8 or "Intel Corporation:Intel Atom x86 System Image:10"
     Name: Intel Atom x86 System Image
     Type: Add-On
     Vendor: Intel Corporation
     Revision: 1
     Description: Intel Atom x86 System Image
     Based on Android 2.3.3 (API level 10)
     Skins: WVGA854, WQVGA400, HVGA, WQVGA432, WVGA800 (default), QVGA
     ABIs : x86
----------
id: 9 or "KYOCERA Corporation:DTS Add-On:10"
     Name: DTS Add-On
     Type: Add-On
     Vendor: KYOCERA Corporation
     Revision: 1
     Description: DTS Add-On
     Based on Android 2.3.3 (API level 10)
     Libraries:
      * com.kyocera.dualscreen (dualscreen.jar)
          Dual Screen optional platform library
     Skins: DTS400 (default), WVGA854, WQVGA400, HVGA, DTS800, WQVGA432, WVGA800, QVGA
     ABIs : armeabi
----------
id: 10 or "LGE:Real3D Add-On:10"
     Name: Real3D Add-On
     Type: Add-On
     Vendor: LGE
     Revision: 1
     Description: Real3D add-on
     Based on Android 2.3.3 (API level 10)
     Libraries:
      * com.lge.real3d (real3d.jar)
          Real3D library
     Skins: WVGA854, WQVGA400, Optimus3D (default), HVGA, WQVGA432, WVGA800, QVGA
     ABIs : armeabi
----------
id: 11 or "android-15"
     Name: Android 4.0.3
     Type: Platform
     API level: 15
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
     ABIs : armeabi-v7a, mips, x86
----------
id: 12 or "Google Inc.:Google APIs:15"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 2
     Description: Android + Google APIs
     Based on Android 4.0.3 (API level 15)
     Libraries:
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: WVGA854, WQVGA400, WSVGA, WXGA720, HVGA, WQVGA432, WVGA800 (default), QVGA, WXGA800
     ABIs : armeabi-v7a
----------
id: 13 or "Motorola Mobility, LLC.:ICS_R2:15"
     Name: ICS_R2
     Type: Add-On
     Vendor: Motorola Mobility, LLC.
     Revision: 2
     Description: Android 4.0.4 phone
     Based on Android 4.0.3 (API level 15)
     Skins: WVGA854, WQVGA400, WSVGA, WXGA720, HVGA, ATRIX-HD (default), WQVGA432, WVGA800, QVGA, WXGA800
     ABIs : armeabi-v7a
----------
id: 14 or "android-16"
     Name: Android 4.1
     Type: Platform
     API level: 16
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
     ABIs : armeabi-v7a, mips, x86
----------
id: 15 or "Google Inc.:Google APIs:16"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 2
     Description: Android + Google APIs
     Based on Android 4.1 (API level 16)
     Libraries:
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: WVGA854, WQVGA400, WSVGA, WXGA800-7in, WXGA720, HVGA, WQVGA432, WVGA800 (default), QVGA, WXGA800
     ABIs : armeabi-v7a

C:\Users\user\AppData\Local\Android\android-sdk\tools>

AVD - 如何產生新的 Android 虛擬機


C:\Users\user\AppData\Local\Android\android-sdk\tools>android create avd -n test -t 1
Auto-selecting single ABI armeabi
Android 2.2 is a basic Android platform.
Do you wish to create a custom hardware profile [no]no  #不客製化#
Created AVD 'test' based on Android 2.2, ARM (armeabi) processor,
with the following hardware config:
hw.lcd.density=240
vm.heapSize=24

C:\Users\user\AppData\Local\Android\android-sdk\tools>

android 指令
參數入下:
create : 產生新的VM.
-n : VM的名字.
-t : 指定開發平台的版本.

iPhone 4S 的電信公司優惠

iPhone 4S 的電信公司優惠
遠傳 VS 中華電信