Setting A File From Asset Folder Causes Mediaplayer To Nullpointer Exception
I have a list of asset folder files, named filelist. I show all that elements in the ListView, so when some of them has been clicked i want it to be played. And here it gives me nu
Solution 1:
Break your code as below to help track your problem*
AssetFileDescriptorafd= getAssets().openFd(filelist[selectedItem]);
selectedItemPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
It seems that filelist[selectedItem]
returns null or it doesnt exist in your assets foldre. Check your main activity at line 251
Post a Comment for "Setting A File From Asset Folder Causes Mediaplayer To Nullpointer Exception"