How to get URI of inserted row in my content observer?

前端 未结 2 1476
被撕碎了的回忆
被撕碎了的回忆 2020-12-21 07:18

In my application, I am inserting values in database from a different class which gives me id of inserted row. I have registered an observer of it in my UI and whenever any

2条回答
  •  生来不讨喜
    2020-12-21 07:29

    Now in android api 16 there is the possibility of getting the URI of the modified row in the OnChage method through a version of the onChange which takes the URI as a parameter. You can find more details about it on the Content Observer documentation http://developer.android.com/reference/android/database/ContentObserver.html

    For on older api versions I am not sure if there is solution (without adding more logic such as implementing flags on your database). I asked that question regarding specifically the old api on " getting changed uri on ContentObserver Onchange on older versions of the API " and did not get any answer =(

提交回复
热议问题