replaced a thread by an asynctask to interact with the ui