fix possible Activity leak

This PR changes Handler class from inner class to static nested class to obviate possible Activity instance leakage.