UIL 默认不支持 scheme(protocol) ERROR
UIL doesn't support scheme(protocol) by default ERROR
I SWITCHED MY APP FROM SUPPORT V4 TO APPCOMPAT V7
。现在我得到以下错误
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
]. 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
]. 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)
我正在通过 XML 从我的服务器下载一个 IMMAGE.JPG。并在列表视图中显示图像
@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;
}
这是下载器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);
}
}
}
我找到了解决方案。我从中解析的服务器中的 xml 文件有错误。错误是我在 link 和 </link>
之间放了一个 space
I SWITCHED MY APP FROM SUPPORT V4 TO APPCOMPAT V7
。现在我得到以下错误
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 ]. 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 ]. 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)
我正在通过 XML 从我的服务器下载一个 IMMAGE.JPG。并在列表视图中显示图像
@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;
}
这是下载器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);
}
}
}
我找到了解决方案。我从中解析的服务器中的 xml 文件有错误。错误是我在 link 和 </link>