2

I'm trying to parser lyric from midi file and get some Vietnamese character such as: ắ, ố, ê,...How do i display these character in textview. Thanks

I had try, but not working

while(it.hasNext()) {
        MidiEvent E = it.next();

        if(E.getClass().equals(Lyrics.class)) {
            Lyrics lyric = (Lyrics)E;
            String a = "";
            try {
                a = new String(lyric.getLyric().getBytes("UTF8"), "UTF8");
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            mLyrics += a;
        }
    }

    TextView txtLyric = (TextView)findViewById(R.id.txtLyric1);

    txtLyric.setText(mLyrics);
Du Huynh
  • 151
  • 1
  • 13

1 Answers1

0

I think you can try to encode the data in UTF-8 and then display them to textview

String original = "";

  try {
      byte[] converted = original.getBytes("UTF8");

  } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
  }
Chinmoy Debnath
  • 2,814
  • 16
  • 20