Cocoa studio:
Welcome to Coco live video player:
Http://pan.baidu.com/share/link? Consumer id = 3291150676 & UK = 4111208708
We need to display TV station icons when developing live videos, and OOM is also common. To solve this problem, I used an open source online network image loading tool Android-universal-image-loader, its official website https://github.com/nostra13/Android-Universal-Image-Loader can help us solve this problem, and variety, the Code not only provides the source code but also provides the demo instance. Let's take a look at the image of its official instance:
Of course, we can define the layout by ourselves. The following describes the precautions for use:
1. First, you must add
public static void initImageLoader(Context context) {// This configuration tuning is custom. You can tune every option, you may tune some of them,// or you can create default configuration by// ImageLoaderConfiguration.createDefault(this);// method.ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).writeDebugLogs() // Remove for release app.build();// Initialize ImageLoader with configuration.ImageLoader.getInstance().init(config);}
Otherwise, when you use imageloader, you will be prompted to use it only after init.
2. Live streaming generally obtains server data, so we also need to parse the data returned by the server (which may be JSON or XML). We can put the parsed data in the list, then, call getview In the adapter.
Imageloader. displayimage (imageurls [position], Holder. Image, options, animatefirstlistener );
The animatefirstlistener is:
private static class AnimateFirstDisplayListener extends SimpleImageLoadingListener {static final List<String> displayedImages = Collections.synchronizedList(new LinkedList<String>());@Overridepublic void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {if (loadedImage != null) {ImageView imageView = (ImageView) view;boolean firstDisplay = !displayedImages.contains(imageUri);if (firstDisplay) {FadeInBitmapDisplayer.animate(imageView, 500);displayedImages.add(imageUri);}}}}
This is done, which is very convenient.
Welcome to Coco live video player:
Http://pan.baidu.com/share/link? Consumer id = 3291150676 & UK = 4111208708