....

2014年9月21日 星期日

[長知識] Android Service 在背景偷偷下載資料不是問題~

在這裡跟大家分享 Android Service的做法,其實非常非常的簡單~

事先準備
1. 你要在哪裡啟動Service
2. 你要在哪裡關閉Service
3. 準備一個class來繼承Service

Let's gooooooooooooooooooo...


[長知識] Android getApplicationContext() VS getBasecontext() 的差異

最常見到選擇這四種選擇的情況是在Toast吧~
Toast.makeText( getApplicationContext() , "Hi~", Toast.LENGTH_SHORT).show();
所以就上網搜尋了一些資料,大概是以下~~~
1. getApplicationContext():
基本上,他會永遠跟著Android Activity的生命週期~

2. getBasecontext():
在Activity跑到 onDestory()的時候,就會被殺掉~

2014年9月13日 星期六

2014年9月12日 星期五