Java tutorial
//package com.java2s; //License from project: Apache License public class Main { private static Boolean sToolbarCheck = null; /** * See if the user has added appcompat-v7, this is done at runtime, so we only check once. * * @return true if the v7.Toolbar is on the classpath */ static boolean canCheckForV7Toolbar() { if (sToolbarCheck == null) { try { Class.forName("android.support.v7.widget.Toolbar"); sToolbarCheck = Boolean.TRUE; } catch (ClassNotFoundException e) { sToolbarCheck = Boolean.FALSE; } } return sToolbarCheck; } }