int id = getResources().getIdentifier("cell00", "id", getPackageName());
TextView currcell = (TextView) findViewById(id);
2012年11月22日 星期四
Android findViewById Dynamically
http://stackoverflow.com/questions/3806847/how-to-create-findviewbyid-parm-dynamically-or-programmatically-at-runtime
2012年11月21日 星期三
Put MapView In ScrollView
參考:http://stackoverflow.com/questions/6546108/mapview-inside-a-scrollview
簡單說就是讓ScrollView內的那一層不要接收Touch事件
簡單說就是讓ScrollView內的那一層不要接收Touch事件
@Override
public boolean onTouchEvent(MotionEvent ev) {
int action = ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
// Disallow ScrollView to intercept touch events.
this.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_UP:
// Allow ScrollView to intercept touch events.
this.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
// Handle MapView's touch events.
super.onTouchEvent(ev);
return true;
}
2012年10月23日 星期二
AQuery - jQuery For Android
jQuery For Android (AQuery)
http://code.google.com/p/android-query/
稍微看了一下,他把jQuery很喜歡用的 Chaining 作法拿過來用
所以整個用法看起來跟在寫網頁的 jQuery 語法很像。
而且這整套其實還是在 Java 環境下,並非在App內放WebView去做。
所以其實並不能叫做用 jQuery 去開發。
而且jQuery的核心精神就是 Write Less, do more.
看起來是真的少了滿多行程式。
而且也把一些常用的 Async 工作包好來用,例如:
去遠端讀取圖片這種平常要寫一海票程式碼才能處理的很漂亮的東西
2012年10月18日 星期四
Use iPhone Like Pull-To-Refresh ListView
這一套是可以讓你做出像是 Facebook 那樣,可以讓使用者下拉列表就可以讀取新資料的Lib
https://github.com/johannilsson/android-pulltorefresh
https://github.com/johannilsson/android-pulltorefresh
Use ActionBar Before Android 3.x
這是一套可以讓 Android 2.1 以上的手機,呈現和 3.x 才有的 ActionBar 一樣的介面。
並且也幫你處理掉一些相容性問題。
Sherlock ActionBar
http://actionbarsherlock.com/
並且也幫你處理掉一些相容性問題。
Sherlock ActionBar
http://actionbarsherlock.com/
jQueryMobile 1.2
1.2正式版出了,所以有專案要使用也比較ok。
比較大的改變是多了一些元件可以使用,請自己點要看的元件玩玩。
Popup
Collapsible ListView
2012年9月20日 星期四
Sort List With Custom Comparator In Python
def asc_comparator(a, b):
return a - b
def desc_comparator(a, b):
return b - a
my_list = [8, 1, 3]
my_list.sort(asc_comparator)
>> [1, 3, 8]
my_list.sort(desc_comparator)
>> [8, 3, 1]
如果a, b是兩個物件也可以自訂comparator去取出要比的東西出來。
comparator 回傳值必須是 int
此為比較日期時因為我用 timedelta.total_seconds() 才注意到的
return a - b
def desc_comparator(a, b):
return b - a
my_list = [8, 1, 3]
my_list.sort(asc_comparator)
>> [1, 3, 8]
my_list.sort(desc_comparator)
>> [8, 3, 1]
如果a, b是兩個物件也可以自訂comparator去取出要比的東西出來。
comparator 回傳值必須是 int
此為比較日期時因為我用 timedelta.total_seconds() 才注意到的
2012年8月13日 星期一
Git Flow Tutorial
英文的,這篇會用指令帶著做一次。
http://alblue.bandlem.com/2011/11/git-tip-of-week-git-flow.html
中文的
http://ihower.tw/blog/archives/5140/
指令:
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
git flow 是一套可以幫助你快速完成並且符合 git 的優良用法的輔助工具
下面介紹基本用法。
- 當然是先安裝 git 和 git flow 啦。
brew install git git-flow - 複製一個 git repository 回來
git clone git@YOUR_HOST/YOUR_REPOS - cd 進去資料夾用預設設定做 init
cd YOUR_REPOS
git flow init -d - 開始寫功能abc
git flow feature start abc - 中間 git commit 好多次後,功能完成
此時 git flow 會幫你 merge 回 develop
git flow feature finish abc - 重複 5. 多次後,準備 release 1.0版
git flow release start v1.0 - 修修改改,準備上正式,此時 git flow 會幫你 merge 回 develop 和 master
git flow frelease finish v1.0
2012年8月12日 星期日
Git Ignore Sample
在各種語言或環境中,可能會 ignore 的範例
把各自的內容寫到各 git 的專案根目錄下的 .gitignore 檔案即可
如果有通用原則,則可以寫到 ~/.gitignore 內。
2012年8月8日 星期三
訂閱:
文章 (Atom)