JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 525 forks source link

Change icon in IconTextView programmatically #198

Open markkko opened 7 years ago

markkko commented 7 years ago

Is it possible to change icon programmatically?

Neither view.setText(getString(R.string.fa_icon_check_square), TextView.BufferType.NORMAL); nor view.setText(getString(R.string.fa_icon_check_square)); not works for me. (view is a type od IconTextView)

bennyboer commented 7 years ago

I just searched for the same answer but didn't find any. After some trial and error I found that although I was modifiying the IconTextView in the onCreate method of an Activity it didn't update the "{}" Icons within the TextViews text attribute. A solution I found is explicitely calling the setText method from the UI thread with view.post(Runnable runnable).

I'm quite new to android development and don't know where the difference is (I thought calling from the onCreate of an Activity is calling the code in the UI Thread?).