Seperate task from activity

Seperate task from activity ,and use callback function to update UI.