2016年4月27日 星期三

Android Studio build error: illegal character: '\ufeff'

References:

http://nobodycare.me/2014/11/07/android-studiode-common-questions/
http://www.codegur.net/36027875/character-set-issue-utf-8
http://lifelongprogrammer.blogspot.tw/2014/05/powershell-and-java-stumble-by-utf8-bom.html

Scenario:

Import android project from Eclipse to Android Studio.

Error message:

illegal character: '\ufeff'


Root cause:

The invisible prefix is \ufeff. U+FEFF is byte order mark (BOM).
But java uses utf8 without bom to read file.

Solution:

Opened the document in notepad and changed the encoding to UTF-8 to save it.

2016年4月19日 星期二

Install Android device driver

References:
http://j796160836.pixnet.net/blog/post/29610725

Step:
1. 到 Android SDK Manager裡安裝 Google USB Driver
2. 進入裝置管理員
3. 找到 Android device,右鍵選擇“更新驅動程式”
4. 瀏覽電腦上的驅動程式軟體
5. 讓我從電腦上的裝置驅動程式清單中挑選
6. 從磁碟安裝
7. 選擇  <你裝的android SDK的路徑>\extras\google\usb_driver\android_winusb
例如:
C:\Users\HueiJheYu\AppData\Local\Android\sdk\extras\google\usb_driver\android_winusb
8. Android ADB Interface

2016年4月7日 星期四

Android UriMatcher.addURI中的 /# 和 /* 解释

Reference:
http://bbs.isgphone.com/archiver/tid-6755.html

說明:
* may be used as a wild card for any text, and # may be used as a wild card for numbers
*: 任何字元
#: 任何數字

The difference between getMeasuredHeight() and getHeight()

Reference:
http://blog.csdn.net/xujainxing/article/details/8985063

說明:
getMeasuredHeight() 是 View實際的大小
getHeight() 是 View 在 Screen內的大小
如果 View超出 Screen的邊界時,getMeasuredHeight() = getHeight() + View超出 Screen的大小