0

@nostra13ライブラリをダウンロードしますhttps://github.com/nostra13/Android-Universal-Image-Loader

上記のリンクにあるサンプルコードを実行すると、ほとんどの画像でREAD TIMED OUT...

私はwifiを試していましたが、ネット速度は良好で、デバイスはSamsungGalaxySでした

手伝ってもらえますか...

4

1 に答える 1

0

Universal Image ローダーがどのように実装されているかの詳細はわかりません。しかし、github のサンプル コードをちらりと見てみると、あることに気付きます。デフォルトのサンプル コードをそのままプロジェクトで使用することはお勧めできません。そのため、サンプル コードがすぐに実行されないのはおそらくそのためです。この構成ブロックを探します

// DON'T COPY THIS CODE TO YOUR PROJECT! This is just example of using ALL options. Most of them have default values.
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .memoryCacheExtraOptions(480, 800) // max width, max height
            .discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75) // Can slow ImageLoader, use it carefully (Better don't use it)
            .threadPoolSize(3)
            .threadPriority(Thread.NORM_PRIORITY - 1)
            .denyCacheImageMultipleSizesInMemory()
            .offOutOfMemoryHandling()
            .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation
            .discCache(new UnlimitedDiscCache(cacheDir)) // You can pass your own disc cache implementation
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
            .imageDownloader(new URLConnectionImageDownloader(5 * 1000, 20 * 1000)) // connectTimeout (5 s), readTimeout (20 s)
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
            .enableLogging()
            .build();
// Initialize ImageLoader with created configuration. Do it once on Application start.
imageLoader.init(config);

また、次のコードを変更して、より長いタイムアウトを使用します。試してみて、これが役に立ったかどうかを報告してください。

  .imageDownloader(new URLConnectionImageDownloader(5 * 1000, 20 * 1000)) // connectTimeout (5 s), readTimeout (20 s)
于 2012-11-28T06:15:53.847 に答える