簡體   English   中英

UIL默認不支持scheme(protocol)錯誤

[英]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不支持scheme(protocol)[ 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 ]。 您應該在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)

我正在通過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);
    }
  }
 }

我找到了解決方案。 我從中解析的服務器中的xml文件中有一個錯誤。 錯誤是我在鏈接和</link>之間放置了空格

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM