AppWidget 관련
appWidgetProvider
public void onEnable(Context context)
: app widget 처음 생성될 때 호출함. 위젯을 여러개 호출해도 처음 한번만 호출됨.
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
: xml에 있는 updatePeriodMillis 값에 따라 주기적으로 호출됨. 위젯을 처음에 호출할 때도 호출됨.
(Configuration activity가 따로 있다면 처음에 호출되지 않음)
보통 여기서 핸들러를 사용해서 작업을 수행함.
public void onDeleted(Context context, int[] appWidgetIds)
: widget host로 부터 삭제될 때 호출됨.
public void onDisabled(Context context)
: 위젯이 삭제될 때 호출됨. onEnable처럼 여러개의 위젯이 있을 때, 마지막 위젯이 detach될 때 호출됨.
public void onReceive(Context context, Intent intent)
: 일반적인 브로드캐스팅 리시버. 내용은 미리 구현되어있어서 굳이 구현할 필요성은 없으나,
필요에 따라 implement를 해서 추가시켜주면 됨.
================================================================
appWidget에서 사용 가능한 뷰
===================================================================
updatePeriodMillis 관련
위젯 업데이트 주기를 위한 updatePeriodMillis........ 이런 ㄱㄱㄲ ㅡㅡ;;
1초 후 업데를 위해 1000을 넣어주면 업데가 안됨. 이유는
최소가 30분이다. 아마 배터리와 ap관련 때문이겠지만... 좀 적어두던가..( ㅡ_-)
developer.android.com에 가야지만이 보인다..(http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html)
이렇게 Note: Updates requested with updatePeriodMillis
will not be delivered more than once every 30 minutes.
잘 알고 판단하자....
30분 이내에 할려면..timer, thread, handler 등등... 사용해서 하면 될 듯...
':::::: STUDY :::::: > Android' 카테고리의 다른 글
Bitmap & BitmapDrawable (0) | 2013.09.12 |
---|---|
화면 크기 구하기 (0) | 2013.09.11 |
[Tip] eclipse에서 xml화면에서 Ctrl+F11로 Run 안될때 (2) | 2013.05.02 |
android.view.InflateException: Binary XML file line #Num:Error inflating class className (0) | 2013.01.23 |
Unable to build: the file dx.jar was not loaded from the SDK folder! (0) | 2012.12.07 |