I am trying to display a location point in map using static map API. This above link contains the image and I am trying to show this image in an ImageView
.
It throws NetworkOnMainThreadException
. So I added these two lines
StrictMode.ThreadPolicy policy =
new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
and now it works fine. But I want to know why NetworkOnMainThreadException.
Is there any other way to do this?