简体   繁体   English

无法解析主机名意味着如何在 android 工作室的异步任务中解决它

[英]Unable to resolve host name means how to resolve it in async task in android studio

Unable to resolve the host name Following the snippet below:无法解析主机名按照以下代码段:

public class Main2Activity extends Activity {

// button to show progress dialog
Button btnShowProgress;

// Progress Dialog
private ProgressDialog pDialog;
ImageView my_image;
// Progress dialog type (0 - for Horizontal progress bar)
public static final int progress_bar_type = 0;

// File url to download
private static String file_url = "https://www.tutorialspoint.com/images/tp-logo-diamond.png";
}                                                                          

Check if your are not using internet permission in AndroidMenifext.xml检查您是否没有在 AndroidMenifext.xml 中使用互联网权限

<uses-permission android:name="android.permission.INTERNET" />

Also ask for the same permission in runtime.还要在运行时请求相同的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM