android - How can I check if a ContentResolver is busy -
android - How can I check if a ContentResolver is busy -
i have button , when user clicks button, should update status of info specified id
public void updatebyclick(int id) { mycursor.movetoposition(id); if (mycursor.getshort(mycursor.getcolumnindex(mytable.status)) == 0) { contentvalues cv = new contentvalues(); cv.put(mytable.status, true); getcontext().getcontentresolver().update(mytable.content_uri, cv, mytable._id + "= ?", new string[] {string.valueof(id + 1)}); } } the problem is, if user clicks button fast (so there lot of updatebyclick events) update operation calls many times (update isnt happened yet, status still == 0)
how can check if contentresolver (or else) busy (currently updating) can prevent multiple update calls
i solve timestamps. every time update method called create timestamp system.currenttimemillis() , check difference lastly saved timestamp. if doesn't reach threshold don't phone call update request.
android android-contentprovider android-cursor
Comments
Post a Comment