Code example for ImageSwitcher

Methods: setFactory, setInAnimation, setOutAnimation

0
     
    final int stub_id=R.drawable.stub;
    public void DisplayImage(final List<String> urls, final ImageSwitcher imageSwitcher)
    { 
    	 
    	imageSwitcher.setFactory(this); 
    	imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(context, 
                    android.R.anim.fade_in)); 
    	imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(context, 
                    android.R.anim.fade_out)); 
    	String url = urls.get(0); 
        imageViews.put(imageSwitcher, url); 
        final Bitmap bitmap=memoryCache.get(url); 
        if(bitmap!=null) { 
        	handler.post(new Runnable() { 
            	@Override 
				public void run() { 
            		imageSwitcher.setImageDrawable(new BitmapDrawable(bitmap)); 
            	} 
            });