Back to project page Skeleton.
The source code is released under:
Apache License
If you think the Android project Skeleton listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gordon.skeleton.annotations; //from w w w . ja va 2 s. com import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.LinkedHashMap; import java.util.Map; import flow.Layout; /** * Created by kg on 11/4/14. */ public class LayoutHelper { private static final Map<Class, Integer> LAYOUT_CACHE = new LinkedHashMap<Class, Integer>(); public static View inflate(Context context, ViewGroup parent, Object screen) { return LayoutInflater.from(context).inflate(getLayout(screen), parent, false); } private static int getLayout(Object screen) { Class screenType = screen.getClass(); if (!LAYOUT_CACHE.containsKey(screenType)) { LAYOUT_CACHE.put(screenType, AnnotationHelper.getAnnotation(screen, Layout.class).value()); } return LAYOUT_CACHE.get(screenType); } }