Sunday, 17 February 2013

How to Display Indian Rupee Symbol in Android ?, Indian Rupee Symbol in Android work All Versions

Rupee Symbol will be work All Android Versions

Screen Shots:
Devices: 2.3 and 4.2

1) MainActivity.java:
package com.venky.displayindianrupeesymbol;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends Activity {

       TextView tv1;
       Typeface face;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_main);

             face = Typeface.createFromAsset(getAssets(), "Rupee.ttf");

             tv1 = (TextView) findViewById(R.id.textView1);
             tv1.setTypeface(face);
            
             tv1.setText("`");
       }
}

2) activity_main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#5F04B4"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp"
        android:gravity="center"
        android:text="Indian Rupee Symbol"
        android:textColor="#FFFFFF"
        android:textSize="20dp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:text="Rupee"
        android:textColor="#FFFFFF"
        android:textSize="40dp"
        android:textStyle="bold" />

</LinearLayout>

3) Download Rupee.ttf file Click Here

4) Download this Project Click Here

3 comments:

  1. Replies
    1. Post updated now Rupee Symbol will be work all Android Versions

      Delete
    2. Download Rupee.ttf file,put into assets folder and try above code then Rupee symbol will be displayed.

      Delete