Read from URL java

后端 未结 4 1279
抹茶落季
抹茶落季 2021-01-03 00:57

I\'m trying to read URL in java, and it works as long as the URL is loading in browser.

But if it is just cylcing in the browser and not loading that page when I\'m

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-03 01:15

    You should add internet permission in AndroidMenifest.xml

    
    

    and add it in the main function:

    if (android.os.Build.VERSION.SDK_INT > 9)
            {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);
            }
    

提交回复
热议问题