Search code examples
javaandroidarraysaudiomp3

Java-MP3File showing initialistaion error


I am using java Library (jid3lib-0.5.4.jar)from http://javamusictag.sourceforge.net/ to get lyrics of a mp3 file something like this :-

    File f= new File(Fragmentactivity.songpaths.get(3)); //file path is correct
                Toast.makeText(getContext(), ""+dstg.getName(), Toast.LENGTH_LONG).show()   ;

                try { 
MP3File d=null;
                if(f.isFile()==true&&f.exists()==true&&f.canWrite()==true)
                     d=new MP3File(dstg.getAbsoluteFile(),false);//here error coming string out of bound exception
                      Lyrics3v2 tag = new Lyrics3v2(d.getLyrics3Tag());
                    Toast.makeText(getContext(), ""+tag.getSongLyric(), Toast.LENGTH_LONG).show()   ;
                } catch (IOException e1) {
                    Toast.makeText(getContext(), "tag prob upper", Toast.LENGTH_LONG).show()    ;

                    } 

                catch (TagException e1) {
                    Toast.makeText(getContext(), "tag prob", Toast.LENGTH_LONG).show()  ;

                }

but it is showing initalisation error . Can anyone tell me why so ?.

Thanks in advance :).


Solution

  • As far as I know if you are running your application on Micromax device with version 4.2.1, you can face this java.lang.StringIndexOutOfBoundsException as it seems to be a manufacturer bug in that specific version for Micromax device. The same problem happened to me once when I had to play a video in splash screen and got the same error in that particular version of Micromax device. Below are the links for the same issue.

    java.lang.StringIndexOutOfBoundsException while playing video in videoView : Android v 4.2.1

    https://groups.google.com/forum/#!topic/android-developers/-WP6uxDebm8

    So try debugging your app other that Micromax version 4.2.1, hope that will work.