apache/cordova-android — pull request #117 by martincgg (2014-08-22 22:50:44+00:00)
Title: [CB-6837][Android] Fix: leaked window when hitting back button while alert being rendered

Created arrayList on ChromeClient that it will register all showed AlertDialog, using CordovaChromeClient class, this applies to AlertDialogs object, included messages, prompts and confirm AlertDialog objects.

When onDestroy() method is called on the CordovaActivity, it will perform a call to ChromeClient class to destroy all AlerDialogs objects registered on the arrayList.
This would perform a cleanup before the CordovaActivity is destroyed.

dlg.show() returns an AlertDialog object, to be added to the arrayList.
It can be:
dialogsManager.add(dlg.show());

But I think it looks cleaner as is already.

Tested on 4.2.2 & 4.4.2.