android.os.NetworkOnMainThreadException. How to solve it?

前端 未结 3 850
醉话见心
醉话见心 2021-01-29 11:22

I am trying to get my current location and get the driving directions to some destination. I am able to get my location and when I execute the code for the driving directions I

3条回答
  •  温柔的废话
    2021-01-29 11:47

    This is cause when you are trying to do networking on the main thread.. it should be done on the background thread..

    solution: AsyncTask

    Click here to learn about AsyncTask

提交回复
热议问题