I want to get the font of the application from database so that i can easily change it whenever i want. So can anyone please tell me how can i change the color of the whole application at run time, mean after getting it from database.
Asked
Active
Viewed 92 times
1 Answers
1
You can create a static method in a class.
class Helper{
private static Typeface mType;
public static Typeface getTypeface(){
if (mType!=null) return mType;
else
{
mType=//Get typeface here
}
}
}
You won't have to get typeface from database more than once. You can customize it if you want more fonts.
Now all you have to do is call this method whenever you want to change font. For example:
textbox.setTypeface(Helper.getTypeface());
If you want to change font of each views in your app, here is best way of doing it.
Good luck!

Community
- 1
- 1

Bipin Bhandari
- 2,694
- 23
- 38
-
You are welcome and set it as answer if it was helpful. Happy coding! – Bipin Bhandari Jan 17 '14 at 14:21
-
1@bipin - You are missing a () at "public static Typeface GetTypeface{". I tried to edit, but you didn't accepted. – Andre Amaral Braga Jan 17 '14 at 14:35
-
1@Dehumanizer I didn't reject it. Some had already rejected it! Anyway thanks! – Bipin Bhandari Jan 17 '14 at 14:39