【问题标题】:UIL doesn't support scheme(protocol) by default ERRORUIL 默认不支持方案(协议) ERROR
【发布时间】:2016-02-22 10:03:30
【问题描述】:

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 默认不支持方案(协议)[ http://www.atlantisipad.it/atlantis.ipad/atlantis1_2014.jpg ]。您应该自己实现此支持 (BaseImageDownloader.getStreamFromOtherSource(...)) java.lang.UnsupportedOperationException:UIL 默认不支持方案(协议)[ http://www.atlantisipad.it/atlantis.ipad/atlantis1_2014.jpg ]。您应该自己实现此支持 (BaseImageDownloader.getStreamFromOtherSource(...)) 在 com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:206) 在 com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:95) 在 com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.saveImageOnDisc(LoadAndDisplayImageTask.java:299) 在 com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:237) 在 com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:149) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 在 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;
    }

这里是下载类

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);
    }
  }
 }

【问题讨论】:

    标签: java xml url android-studio xmlpullparser


    【解决方案1】:

    我找到了解决方案。我正在解析的服务器中的 xml 文件有错误。错误是我在链接和</link>之间放了一个空格

    【讨论】:

      猜你喜欢
      • 2016-07-03
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 2013-09-25
      • 2018-12-03
      • 2020-12-14
      • 2018-06-29
      • 1970-01-01
      相关资源
      最近更新 更多