1

I'm trying to show currency symbols on the dropdown in my monodroid application.

As you know currency units contain some thing like "र". but when I run application, the drop down just show a rectangle instead of "र".

How I can make it human-readable?

EDIT

Actually I parse this json for accessing to the unit ( saving the name attribute to a string variable):

{"id":"167","name":"\u0930","type":"4","enabled":"1","tosi":"0.0182","index":"1","extra":"INR","extra2":"Indian Rupee","extra3":"India","extra4":"Paisa","seperator":",","d_seperator":"","after_before":"0"},

When I parse it, in run-time the string variable includes "र" but when I show it on the dropdown the device show a box.

So according to 'Sam' comment I use this code. I pass the string varible to method and show the return string to the dropdow. but yet I see a box :(

    public static string ConvertUnitsEncoding(Activity act,string Encoded){
        try {
            if( Encoded =="र")
                return act. Resources .GetString(Resource .String .IndianUnit );
            else
                return Encoded ;
        } catch (Exception ex) {
            RltLog .HandleException (ex);
            return Encoded ;
        }
    }
Husein Behboudi Rad
  • 5,434
  • 11
  • 57
  • 115

1 Answers1

1

You've got two options:

  • Either load a custom font that includes that special character:

    TextView tv = (TextView)findViewById(R.id.tv);
    // Put the font in the asset folder
    Typeface tf = Typeface.createFromAsset(Context.Assets, "Symbol.ttf");
    tv.setTypeface(tf);
    

    Most of the installed fonts on Windows have a currency subset which includes currency symbols but not Rupee. I read somewhere that Microsoft Update will add the Rupee to the fonts but I don't have it on my system. I have found Amty Currency Font with Rupee support but I'm not sure how useful it would be for your case. Try it.

  • Or simply use a small image for that purpose. I would prefer this approach because it's platform independent and you can find lots of symbol icons out there. Something like this:

    Android Dropdown Money Icon

Sam R.
  • 16,027
  • 12
  • 69
  • 122
  • Thanks for reply. I see that iPhone support it by defualt. actually I Want to show A list of currency and area units. if I want to use a font for this I should have a font that support all of them. do any body knows one font that support all of them? – Husein Behboudi Rad May 18 '13 at 08:17
  • @HuseinBehbudiRad, Found another option for you [Set Indian Rupee symbol on text view](http://stackoverflow.com/q/15158754/1693859). I think if you find the corresponding Unicode for the symbols, it'll be sorted out. – Sam R. May 18 '13 at 08:25
  • Please see http://stackoverflow.com/q/15158754/1939409 and 'Nadhi' comments. in devices with lower version it not works yet. Is there any other way for supporting on the lower versions alos? – Husein Behboudi Rad May 18 '13 at 08:59
  • 1
    @HuseinBehbudiRad, The only solid way I can think of is just using a small image to support every version. Let me search a little for a suitable font. It might be easier to implement. I'll keep you informed. – Sam R. May 18 '13 at 09:08
  • I created Amty Currency Font a long time back to give support for my one of the projects. But as font comes in 4 different fonts, there can be some devices which support particular format only. – Amit Kumar Gupta Oct 13 '16 at 18:25