Original code from (Cocos2d-android ZhouWeikuan)