Make MediaUtil.getBitmapDrawable asynchronous
When the minSdkVersion is >= 10 and the user attempts to set an image to a non-file URL, the Android runtime will throw an android.os.NetworkOnMainThreadException. This commit changes the behavior of MediaUtil.getBitmapDrawable to an asynchronous design that takes a callback that will be triggered after the bitmap has been loaded. If an exception occurs, an onException callback will be used. Other failures are reported via the onFailure callback. Due to the change to AsyncCallbackPair, this change also affects a number of other components that may or may not have been performing network access on the main thread. Testing of this change should focus on the following components: * ButtonBase and its descendants * Canvas * Form * GameClient * HVArrangement and its descendants * Image * ImageSprite * MediaStore * TinyWebDB * Voting Change-Id: Ib9bd0a0a929b26ad44eeda58a7c637398dd70219
Showing
This diff is collapsed.
Please register or sign in to comment