- 작성시간 : 2013/12/10 18:21
- 퍼머링크 : always19.egloos.com/2962902
- 덧글수 : 0
안드로이드에서 ViewPager로 여러 page를 보여주는데,
data는 한 table에 들어있고, 여러 filtering조건으로 다른 page를 보여주는 경우,
일부라도 update가 되면, 모든 page를 update해서 느리고, 부담이 된다.
contentResolver.notifyChange를 일부 uri로만 하기 위해서 uri를 나누기.
.../FILTER/1
.../FILTER/2
이런 식으로.
CursorLoader, CursorAdapter를 쓸 때,
Cursor를 changeCursor하기 전에 setNotificationUri를 해야 잘 작동한다.
기존에 default로 받던 notification는 받지 않게 되고,
지정한 uri에 대해 notification을 받는 것 같다.
public abstract void setNotificationUri (ContentResolver cr, Uri uri)
Added in API level 1
Register to watch a content URI for changes. This can be the URI of a specific data row (for example, "content://my_provider_type/23"), or a a generic URI for a content type.
Parameters
| cr | The content resolver from the caller's context. The listener attached to this resolver will be notified. |
|---|---|
| uri | The content URI to watch. |
CursorAdpater의 onContentChange에서 확인할 수 있다.



덧글