combine these 2 lines: TiBaseActivity dialogActivity = (TiBaseActivity) getCurrentActivity();