Tested on API 18:
Perform the check by posting a Runnable
to the WebView
:
WebView webView = (WebView) findViewById(R.id.webview_id);
// Shows: "Is hardware accelerated? false"
// Toast.makeText(YourActivity.this, "Is hardware accelerated? " +
// webView.isHardwareAccelerated(),
// Toast.LENGTH_LONG).show();
webView.post(new Runnable() {
@Override
public void run() {
Shows: "Is hardware accelerated? true"
Toast.makeText(YourActivity.this, "Is hardware accelerated? " +
webView.isHardwareAccelerated(),
Toast.LENGTH_LONG).show();
if (webView.isHardwareAccelerated()) {
// isAccelerated();
} else {
// isNotAccelerated();
}
}
});
From resource page on Hardware Acceleration:
Hardware acceleration is enabled by default if your Target API level is >=14, but can also be explicitly enabled.
If the image you are displaying is still pixelated, try setting:
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
and see if pixelation of the image gets better.
Consider reading the resource page on Hardware Acceleration.