How to solve NullPointerException error in Android?
NullPointerException means that mp is null. This means the MediaPlayer.create() failed. Does R.raw.alarm exist?
NullPointerException means that mp is null. This means the MediaPlayer.create() failed. Does R.raw.alarm exist?
In Android SF framework, the codecs are registered through media_codecs.xml. In standard android distribution, an example media_codecs.xml can be found here. All audio-visual components are registered as OMX components. 1. Codec Registration To register your video decoder, you would have to add a new entry under <Decoders> list. To ensure that your codec is always … Read more
simple Media Player with streaming example.For xml part you need one button with id button1 and two images in your drawable folder with name button_pause and button_play and please don’t forget to add the internet permission in your manifest. public class MainActivity extends Activity { private Button btn; /** * help to toggle between play … Read more
If you have a look at the GoNative sample here (docs and code), you’ll find a way to add Android native code to your JavaFX project. This is a simple example of adding android.media.MediaPlayer to a JavaFX project using the Gluon plugin. Based on a Single View project, let’s add first an interface with the … Read more
It means your platform does not support QCMediaPlayer. QCMediaPlayer provides extended APIs and interfaces to get and set MPD attributes for DASH protocol in compatible Snapdragon builds. So, this error should not affect on media playing in normal case Check this sources to find out more details: QCMediaPlayer.java
You are not giving an awful lot of specifics on what exactly you have tried and what the problematic areas are, so I just made a small test to see if I could reproduce any of what you’re describing. I do not have any conclusive findings, but can at least confirm that my Galaxy Nexus … Read more
Before prepare(), you need first to call setDataSource(..). The Media framework is a very strict state machine, and it’s really cumbersome to handle all the different states. I’ve used this little wrapper that makes the coding/debugging a bit easier. You can give it a try. Regarding emulator – note that not all file formats are … Read more
As it turns out, error -2147483648 indicates an unknown error. This could have something to do with the video encoding, but it’s also worth checking that the file path exists and that the VideoView has permission to read it. My issue was that I was writing my files with Context.MODE_PRIVATE (the default). openFileOutput(filename, Context.MODE_PRIVATE); This … Read more
The answer to this question turned out to be an issue on Android firmware installed on Samsung S III devices running Android 4.1.2. It seemed to have been something relating to the source of the stream, because some sources eventually played on the device, but the one we needed, never played. If you can get … Read more
Thanks you for your answers! Appreciate it! Here’s how I finally managed to get it work: button[i].setOnClickListener(new OnClickListener() { public void onClick(View view) { mp = MediaPlayer.create(Test.this, R.raw.mysound); mp.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { // TODO Auto-generated method stub mp.release(); } }); mp.start(); } });