gpt4 book ai didi

android - HttpURLConnection 抛出异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:47:40 25 4
gpt4 key购买 nike

<分区>

这是我连接 HTTP 的代码。

URL url = new URL("http://www.google.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
String responseMsg = con.getResponseMessage();
int response = con.getResponseCode();

这是抛出 android.os.NetworkOnMainThreadException

请帮忙。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com