Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i display rupee in android using below code

Typeface face = Typeface.createFromAsset(getAssets(), "Rupee_Foradian.ttf");
errormsgtodisplay.setTypeface(face);
errormsgtodisplay.setText("Your Cash Balance is " + getResources().getString(R.string.rs)+otherinformation);

it works fine but it also changes font style of text Your Cash Balance is i want that text should use previous font style not that of Rupee_Foradian.ttf
Posted
Updated 10-Mar-16 19:32pm

Why don't you use the Unicode characters?


use <string> resource with Unicode.
http://developer.android.com/guide/topics/resources/string-resource.html[^]

you can use either
XML
<string name="rupee">\u20B9</string>

or
XML
<string name="rupee">\u20A8</string> 
 
Share this answer
 
Comments
garav kumar mishra 1-Dec-13 23:34pm    
but the above solution doesn't works for some mobile.
Not working on mine
use any other second argument in your code
Typeface face = Typeface.createFromAsset(getAssets(), "Rupee_Foradian.ttf");
 
Share this answer
 
if above ones didn't work. try this

Java
String string = "\u20B9";
byte[] utf8 = null;
utf8 = string.getBytes("UTF-8");
string = new String(utf8, "UTF-8");

Thank me later
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900