contentResolver.registerContentObserver(MediaStore.Files.getContentUri("external"), false, new ContentObserver(new Handler())
{
@Override
public boolean deliverSelfNotifications()
{
Log.d("TAG", "deliverSelfNotifications");
return super.deliverSelfNotifications();
}
@Override
public void onChange(boolean selfChange)
{
super.onChange(selfChange);
Log.d("TAG", "onChange");
}
@Override
public void onChange(boolean selfChange, Uri uri)
{
super.onChange(selfChange, uri);
Log.d("TAG", "onChange " + uri.toString());
}
});
当我删除文件时, onChange()会调用,但添加文件后将无法正常工作。
非常感谢您的帮助!