Click here to Skip to main content
11,632,172 members (76,973 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android Application
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 use android midi lib to parser lyric of midi song http://code.google.com/p/android-midi-lib/[^])

This is my code

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);
Posted 29-Jan-13 22:34pm
DuHuynh419
Edited 3-Feb-13 14:51pm
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Are you working in the emulator, because it has had problems in the past with some character codes.

Does it work when using a phone/tablet ?

What does get displayed ? Does it look like [] ?

What version of Android are you looking to deploy too ?

Whilst old you should look at Emulator issues[^] this has code attached (PinyinTest.zip) which you could quickly try on different API versions.


/Darren
  Permalink  
Comments
DuHuynh at 3-Feb-13 9:14am
   
I had try on my HTC Desire HD but get same problem. I develop with android v 4.0.3
These are images of problem
http://nu5.upanh.com/b5.s32.d1/683e72b0326694c21cf4e575e07c0502_53099735.untitled1.jpg
http://nu7.upanh.com/b2.s32.d1/0c980b8163ccae2e407edb1f756de694_53099737.untitled2.jpg
Darren_vms at 3-Feb-13 14:35pm
   
I'm unable to see the images the site times out, did you try PinyinTest I pointed out on the link above ?
DuHuynh at 3-Feb-13 20:34pm
   
Yes, i had try. I don't think this is problem of API version, because when i use TextView.SetText("Vietnamese character") it display fine as you see in images i attached.
I had checked image link, it still work fine
DuHuynh at 3-Feb-13 20:49pm
   
I think this is problem of android midi lib http://code.google.com/p/android-midi-lib/
Darren_vms at 6-Feb-13 6:09am
   
I noticed you added a few bugs to this, perhaps the problem lies in TextualMetaEvent.java or text.java

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

  Print Answers RSS
0 OriginalGriff 8,498
1 Sergey Alexandrovich Kryukov 8,149
2 Mika Wendelius 6,260
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 1,995


Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100