package com.michaldabski.utils;

import android.util.SparseArray;
import android.view.View;

public class ViewHolder
{
	final View root;
	final SparseArray<View> views = new SparseArray<View>(3);
	
	public ViewHolder(View root)
	{
		this.root = root;
	}
	
	@SuppressWarnings("unchecked")
	public <T extends View> T getViewById(int id)
	{
		T view = (T) views.get(id);
		if (view == null)
		{
			views.put(id, (view = (T) root.findViewById(id)));
			if (view == null)
				throw new NullPointerException("Cannot find requested view id "+String.valueOf(id));
		}
		return view;
	}
}

@@ -571,10 +571,245 @@
 iew;%0A%09%7D%0A
+%09%0A%09public boolean hasView(int id)%0A%09%7B%0A%09%09if (views.get(id) != null) return true;%0A%09%09else%0A%09%09%7B%0A%09%09%09View view = this.root.findViewById(id);%0A%09%09%09if (view == null) return false;%0A%09%09%09else%0A%09%09%09%7B%0A%09%09%09%09views.put(id, view);%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A
 %7D%0A

Add hasView() method to viewHolder