It won't work by doing Uri.parse on an arbitrary string value.
I don't think it will work at all. What's the use case? It suggests that something outside of your control is modifying a variable. How can this happen?
سؤال
Is it possible to use a ContentObserver
to monitor variable changes (e.g. String) by constructing a Uri and passing it as an argument when registering? If yes, can you provide a functional example?
المحلول
It won't work by doing Uri.parse on an arbitrary string value.
I don't think it will work at all. What's the use case? It suggests that something outside of your control is modifying a variable. How can this happen?
نصائح أخرى
It should work with string value,
It works with me. I have used Uri.parse
like below:
contentResolver.notifyChange(Uri.parse("content://com.example.provider/notification"), null)