Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: AndroidApplication
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 515
1 OriginalGriff 468
2 Abhinav S 305
3 sanket saxena 295
4 Tadit Dash 160
0 Sergey Alexandrovich Kryukov 8,482
1 OriginalGriff 4,830
2 Peter Leow 3,794
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid