Programmatically set text color to primary android textview -


how can set text color of textview ?android:textcolorprimary programmatically?

i've tried code below sets text color white both textcolorprimary , textcolorprimaryinverse (both of them not white, have checked through xml).

typedvalue typedvalue = new typedvalue(); resources.theme theme = getactivity().gettheme(); theme.resolveattribute(android.r.attr.textcolorprimaryinverse, typedvalue, true); int primarycolor = typedvalue.data;  mtextview.settextcolor(primarycolor); 

finally used following code primary text color of theme -

// primary text color of theme typedvalue typedvalue = new typedvalue(); resources.theme theme = getactivity().gettheme(); theme.resolveattribute(android.r.attr.textcolorprimary, typedvalue, true); typedarray arr =         getactivity().obtainstyledattributes(typedvalue.data, new int[]{                 android.r.attr.textcolorprimary}); int primarycolor = arr.getcolor(0, -1); 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -