Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

C#
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
Updated 3-Feb-13 14:51pm
v3

1 solution

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
 
Share this answer
 
Comments
DuHuynh 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 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 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 3-Feb-13 20:49pm    
I think this is problem of android midi lib http://code.google.com/p/android-midi-lib/
Darren_vms 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900