zundi zundi - 1 year ago 82
Android Question

How to return to default font in TextView

I know how to change the font of a TextView to my own font:

catTextView = (TextView)findViewById(R.id.CatText);
catTextView.setTypeface(Typeface.createFromAsset(getAssets(), "my_font_in_assets"));

However at a point during the app execution, I would like to set it back to the default font. I don't want to hardcode the font (write "Droid Sans") since the default font could change in future versions of Android (I think it actually did in ICS).

Is there any way to get the default font name of a TextView, and set it back to this after changing it?

Also, can I be sure the default font will always be able to show Russian or Japanese characters?


Answer Source

Have you tried calling getTypeface() in your TextView before you change it and store the result somewhere?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download