NullPoiterExeption when use ButtonFlat.setTextColor . Your declare "TextView textButton;" inside ButtonFlat is duplicate with supperclass