public static String getViewType(View view) {
        String cacheViewType = SnapCache.getInstance().getViewType(view);
        String viewType;
        if (cacheViewType == null) {
            viewType = SnapCache.getInstance().getCanonicalName(view.getClass());
            if (view instanceof CheckBox) { // CheckBox
                viewType = SAViewUtils.getViewType(viewType, "CheckBox");
            } else if (view instanceof RadioButton) { // RadioButton
                viewType = SAViewUtils.getViewType(viewType, "RadioButton");
            } else if (view instanceof ToggleButton) { // ToggleButton
                viewType = SAViewUtils.getViewType(viewType, "ToggleButton");
            } else if (view instanceof CompoundButton) {
                viewType = SAViewUtils.getViewTypeByReflect(view);
            } else if (view instanceof Button) { // Button
                viewType = SAViewUtils.getViewType(viewType, "Button");
            } else if (view instanceof CheckedTextView) { // CheckedTextView
                viewType = SAViewUtils.getViewType(viewType, "CheckedTextView");
            } else if (view instanceof TextView) { // TextView
                viewType = SAViewUtils.getViewType(viewType, "TextView");
            } else if (view instanceof ImageView) { // ImageView
                viewType = SAViewUtils.getViewType(viewType, "ImageView");
            } else if (view instanceof RatingBar) {
                viewType = SAViewUtils.getViewType(viewType, "RatingBar");
            } else if (view instanceof SeekBar) {
                viewType = SAViewUtils.getViewType(viewType, "SeekBar");
            } else if (view instanceof Spinner) {
                viewType = SAViewUtils.getViewType(viewType, "Spinner");
            } else if (instanceOfTabView(view) != null) {
                viewType = SAViewUtils.getViewType(viewType, "TabLayout");
            } else if (instanceOfNavigationView(view)) {
                viewType = SAViewUtils.getViewType(viewType, "NavigationView");
            } else if (view instanceof ViewGroup) {
                viewType = SAViewUtils.getViewGroupTypeByReflect(view);
            }

            SnapCache.getInstance().setViewType(view, viewType);
        } else {
            viewType = cacheViewType;
        }

        return viewType;
    }
@Test
    public void getViewType() {
        CheckBox textView1 = new CheckBox(mApplication);
        textView1.setText("child1");
        Assert.assertEquals("CheckBox",
                SAViewUtils.getViewType(textView1));
    }