Challenge: Announcing Events

By adding dynamic content descriptions to the crime scene photo ImageView, you improved the crime scene photo experience. But the onus is on the TalkBack user to press on the ImageView to check its status. A sighted user has the benefit of seeing the image change (or not) when returning from the camera app.

You can provide a similar experience via TalkBack by announcing what happened as a result of the camera app closing. Read up on the View.announceForAccessibility(…) method in the documentation and use it in CriminalIntent at the appropriate time.

You might consider making the announcement in onActivityResult(…). If you do, there will be some timing issues related to the activity lifecycle. You can get around these by delaying the announcement for a small amount of time by posting a Runnable (which you will learn more about in Chapter 26). It might look something like this:

mSomeView.postDelayed(new Runnable() {
    @Override
    public void run() {
        // Code for making announcement goes here
    }
}, SOME_DURATION_IN_MILLIS);

You could avoid using a Runnable by instead using some other mechanism for knowing when to announce the change. For example, you might consider making the announcement in onResume() instead – though you would then need to keep track of whether the user has just returned from the camera app.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
54.221.110.87