android - How can i use malayalam ASCII fonts? -


I'm starting with app developers. I am facing a problem when adding ASCII fonts in text view. How can I add some text to the text box which is in ASCII

There are two approaches you can use

1) If the data is HTML with ASCII.

  txtview.setText (Html.fromHtml (asciiString));  

2) If the data contains only ASCII Try

  {textView.setText (new string (asciiString.getBytes ("UTF-8"), "UTF-8"); } Hold (unsupported encoding exception e) {e.printStackTrace (); }  

Example:

MainActivity.java

  expands the public square MainActivity activity { @Override protected Crete on the bundle (bundled saved instainstate) {super.naught (saved instant state); SetContentView (R.layout.activity_main); TextView textView = (TextView) findViewById (R.id.textView); {TextView.setTypeface (tryface.createFromAsset (getAssets (), "APPLET.TTF") try; TextView.setText (new String ( "bymÀ ° AÀlXbpÅh³" .getBytes ( "UTF-8"), "UTF-8" ));} catch (unsupported encoding exception e) {e.printStackTrace ();}}}  

activity_main.xml

  & lt; relative layout xmlns: android = "http://schemas.android.com/apk/res/android" Android: Leaut_vind = "Mac_perent" Android: Leaut_hehet = "Mac_perent" & gt; & Lt; TextView android: id = "@ + id / textView "Android: layout_width =" match_parent "Android: layout_height =" match_parent "/ & gt; & Lt; / RelativeLayout & gt;  

Autaut: < / P>

Note:

In each folder of your project Keep APPLET.TTF file


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -