2013年5月15日 星期三

[Android Map] Change Location of Emulator

See the Article
http://developer.android.com/guide/topics/location/strategies.html#MockData

HighLight


Using the "geo" command in the emulator console



Step1: 執行 cmd 
    執行 cmd ,  cd 到 Android SDK 下的 tools   ie:  C:\Android\tools


Step2: 連上 emulator
     telent localhost 5554 
     5554 是 emulator 的 port , 通常會顯是在 emulator 後面。 
    可用 help 看一下 commands
   

2013年5月13日 星期一

[Android] MyTracks Notes (1)


AbstractMyTracksActivity

*public abstract class AbstractMyTracksActivity extends FragmentActivity 

*onCreate()
         1.  SpeechEngine 的 setup
               setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
         2. 一個個不同api 版本的不同設置 actionbar 與 home 鑑
             * ApiAdapterFactory.getApiAdapter().hideTitle(this)
             * ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
         
         3. setContentView

2013年5月10日 星期五

[Java] 認真的讀一次 Java Class 做個 Note


Creating A Class 

Class : Class definition and Class body

public/abstract/final  class  (NameOfClass) extends (Super) implements (Interface01, Interface02, ...) {
                         Class Body
}

public : 可以被任何 class 使用。沒有 public 只能給同一個 package 的使用
abstract :  宣告無法被 instantiated 的 class
final : 宣告無法被繼承的 class

Variable :  可以宣告的項目

accessLevel  (static/final/transient/volatile ) type name
    accessLevel :  宣告可以可 access memeber varialbe 的種類(public/protected/package/private)
   static : class variable 而不是 instance variable
   final : variable 的值無法改變
   transient: variable 不應該被 serialized
   volatile : 防止 compiler 對一個 member 進行某種最佳化
   type nmae : variable type and name


2013年5月8日 星期三

[Android] Use Google Map API v2 (3) - Work on emulator


此篇為 [Android] Use Google Map API v2 - Create a map project 續篇


在 emulator 上 run google map 會出現下圖 -

發現此狀況時需要在 emulator 上安裝 2 個  apk . 
com.google.android.gms(-xxx).apk
com.android.vending(-xxx).apk
這個部份說一下, Google 說地圖無法再 emulator 上使用。 搜尋會看到很多這麼說。
不要放棄,應該是可以的。 但看起來每個人成功的方法不太一樣。我僅提供我的。

[Android] Use Google Map API v2 - Create a map project


此篇為續 [Android] Use Google Map API v2 - Get API Key


Step 3. Create a Map project

3.1 一如往常的 Create 一個 Android APP。
3.2 修改 Manifest.xml
*在 <application> Tag 裡加入
<meta-data    android:name="com.google.android.maps.v2.API_KEY"    android:value="AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0"/>裡面的 android:value 裡填 Step2 最後獲取40characters 的 APIKEY

2013年5月7日 星期二

[Android] Use Google Map API v2 - Get API Key


Google Developer :Google Maps Android API v2

說明 :

Step 1. Download Google Map API 
在 Eclipse 裡, 使用 Android SDK Manager, 找到 Extra , 看看 Google Play Service 是否有 installed 。

Step 2. Apply for Google Map Key 
使用Google Map 的 Service 需要有簽證\證書。 證書分為兩種 Debug 與 Release。 Debug 不可以用來 Release 。 首先我們先申請Debug。Realease 方法以後再加補。

獲取的方法如下
Debug:
1. 在 cmd 下打此指令

keytool -list -v -keystore "C:\Users\your_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

*your_user_name => 你的使用者名稱。
我的 Android SDK 並不是裝在 Default Directory,但這個目錄仍是在 User\(One's User name) 底下。
* 如果 cmd 下輸入指令沒有 keytool 這個指令的話,可能是 Java 環境變數沒設。 
參考: 設定Java 環境變數

成功了會跑出下列輸出

SHA1 後面就是 fingerprint
(長這樣 SHA1: BB:0D:AC:74:D3:21:E1:43:07:71:9B:62:90:AF:A1:66:6E:44:5D:75) 


2013年5月5日 星期日

[Android] Screen Size Notes






  • xlarge screens are at least 960dp x 720dp
  • large screens are at least 640dp x 480dp
  • normal screens are at least 470dp x 320dp
  • small screens are at least 426dp x 320dp
Screen characteristic Qualifier Description
Size small Resources for small size screens.
normal Resources for normal size screens. (This is the baseline size.)
large Resources for large size screens.
xlarge Resources for extra large size screens.
Density ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi).
nodpi Resources for all densities. These are density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.
tvdpi Resources for screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. If you find it necessary to provide tvdpi resources, you should size them at a factor of 1.33*mdpi. For example, a 100px x 100px image for mdpi screens should be 133px x 133px for tvdpi.
Orientation land Resources for screens in the landscape orientation (wide aspect ratio).
port Resources for screens in the portrait orientation (tall aspect ratio).
Aspect ratio long Resources for screens that have a significantly taller or wider aspect ratio (when in portrait or landscape orientation, respectively) than the baseline screen configuration.
notlong Resources for use screens that have an aspect ratio that is similar to the baseline screen configuration.





Screen Resolution Names


http://tekeye.biz/2012/screen-resolution-names