JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...

Home Page:http://joanzapata.com/android-iconify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change icon in IconTextView programmatically

markkko opened this issue · comments

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)

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?).