【发布时间】:2013-03-10 14:21:54
【问题描述】:
除了应用程序,我没有收到任何错误。什么都不做。
下载链接http://www.helloandroid.com/tutorials/how-download-fileimage-url-your-device
package com.androidhive.httprequests;
import java.io.IOException;
import java.net.URL;
import android.util.Log;
import com.androidhive.httprequests.AndroidHTTPRequestsActivity;
public class DownloadFromUrl {
public static void main ()
{
try {
AndroidHTTPRequestsActivity hallo = new AndroidHTTPRequestsActivity();
String imageURL2 = "sample.jpg";
URL url = new URL("http://api.androidhive.info/images/" + imageURL2);
String filename2 = String.valueOf(url.hashCode());
hallo.DownloadFromUrl(imageURL2, filename2);
} catch (IOException e) {
Log.d("ImageManager", "Error: " + e);
}
}
【问题讨论】:
-
请发布 logcat 日志。您遇到什么错误?
-
您是否更新了 AndroidManifest.xml 以获得 Internet 权限?
-
是的,问题是我没有收到任何错误
-
好吧,您发布的代码不是来自 Android 应用程序。这是一个简单的 Java 应用程序。
-
我如何在 Android 中做到这一点?
标签: android html image load httprequest