[英]UIL doesn't support scheme(protocol) by default ERROR
I SWITCHED MY APP FROM SUPPORT V4 TO APPCOMPAT V7
. I SWITCHED MY APP FROM SUPPORT V4 TO APPCOMPAT V7
。 Now I got the following error 现在我得到以下错误
02-22 10:48:00.873 10619-11054/com.makemyandroidapp.example.atlantissites E/ImageLoader: UIL doesn't support scheme(protocol) by default [ http://www.atlantisipad.it/atlantis.ipad/atlantis1_2014.jpg ].
02-22 10:48:00.873 10619-11054 / com.makemyandroidapp.example.atlantissites E / ImageLoader:默认情况下UIL不支持scheme(protocol)[ http://www.atlantisipad.it/atlantis.ipad/atlantis1_2014 .jpg ]。 You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...)) java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [ http://www.atlantisipad.it/atlantis.ipad/atlantis1_2014.jpg ].
您应该自己实现此支持(BaseImageDownloader.getStreamFromOtherSource(...))java.lang.UnsupportedOperationException:默认情况下,UIL不支持scheme(protocol)[ http://www.atlantisipad.it/atlantis.ipad/atlantis1_2014。 jpg ]。 You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...)) at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:206) at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:95) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.saveImageOnDisc(LoadAndDisplayImageTask.java:299) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:237) at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:149) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
您应该在com.nostra13.universalimageloader.core.download.BaseImageDownloader上的com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:206)上自己实现此支持(BaseImageDownloader.getStreamFromOtherSource(...))。 com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.saveImageOnDisc(LoadAndDisplayImageTask.java:299)处的com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:237)处的getStream(BaseImageDownloader.java:95) .universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:149)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:587 )的java.lang.Thread.run(Thread.java:818)
I'M DOWLOADING AN IMMAGE.JPG FROM MY SERVER BY XML. 我正在通过XML从服务器上下载IMMAGE.JPG。 AND SHOW THE IMAGE IN A LISTVIEW
并在列表视图中显示图像
@Override
protected Void doInBackground(Void... arg0) {
//Download the file
try {
Downloader.DownloadFromUrl("http://www.atlantisipad.it/atlantis.ipad/AtlantisAndroid.xml", openFileOutput("AtlantisSites.xml", Context.MODE_PRIVATE));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
}
AND HERE IS DOWLOADER CLASS 这是下载程序类
package com.makemyandroidapp.example.atlantissites;
public class Downloader extends AppCompatActivity {
//Tag for Log statements
private static String myTag = "AtlantisSites";
//Handler msg that represents we are posting a progress update.
static final int POST_PROGRESS = 1;
/************************************************
* Download a file from the Internet and store it locally
*
* @param URL - the url of the file to download
* @param fos - a FileOutputStream to save the downloaded file to.
************************************************/
public static void DownloadFromUrl(String URL, FileOutputStream fos) { //this is the downloader method
try {
URL url = new URL(URL); //URL of the file
//keep the start time so we can display how long it took to the Log.
long startTime = System.currentTimeMillis();
Log.d(myTag, "download begining");
// Open a connection to that URL.
URLConnection ucon = url.openConnection();
// this will be useful so that you can show a tipical 0-100% progress bar
//int lenghtOfFile = ucon.getContentLength();
Log.i(myTag, "Opened Connection");
/************************************************
* Define InputStreams to read from the URLConnection.
************************************************/
InputStream is = ucon.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Log.i(myTag, "Got InputStream and BufferedInputStream");
/************************************************
* Define OutputStreams to write to our file.
************************************************/
BufferedOutputStream bos = new BufferedOutputStream(fos);
Log.i(myTag, "Got FileOutputStream and BufferedOutputStream");
/************************************************
* Start reading the and writing our file.
************************************************/
byte data[] = new byte[1024];
//long total = 0;
int count;
//loop and read the current chunk
while ((count = bis.read(data)) != -1) {
//keep track of size for progress.
//total += count;
//write this chunk
bos.write(data, 0, count);
}
//Have to call flush or the file can get corrupted.
bos.flush();
bos.close();
Log.d(myTag, "download ready in "
+ ((System.currentTimeMillis() - startTime))
+ " milisec");
} catch (IOException e) {
Log.d(myTag, "Error: " + e);
}
}
}
I found the solution. 我找到了解决方案。 There was a mistake in the xml file in the server where I'm parsing from.
我从中解析的服务器中的xml文件中有一个错误。 The mistake was that I put a space between the link and the
</link>
错误是我在链接和
</link>
之间放置了空格
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.