That error is saying that you are trying to change the UI(Toast) from a different thread.. if you want to change the UI from a different thread you must call the UI/Main thread first and put it there..
Sample::
runOnUiThread(new Runnable() {
@Override
public void run() {
//Do the changing of UI here
}
});