Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7646431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:12:23+00:00 2026-05-31T10:12:23+00:00

I’ve got the following error: thread exiting with uncaught exception (group=0x4001b188). Nullpointerexception And this

  • 0

I’ve got the following error: thread exiting with uncaught exception (group=0x4001b188). Nullpointerexception
And this is caused by the following code:
package org.apache.android.media;

import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnBufferingUpdateListener;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.media.MediaPlayer.OnVideoSizeChangedListener;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.Toast;


public class VideoViewDemo extends Activity implements
    OnBufferingUpdateListener, OnCompletionListener,
    OnPreparedListener, OnVideoSizeChangedListener, SurfaceHolder.Callback {

private static final String TAG = "MediaPlayerDemo";
private int mVideoWidth;
private int mVideoHeight;
private MediaPlayer mMediaPlayer;
private SurfaceView mPreview;
private SurfaceHolder holder;
private String path;
private Bundle extras;
private static final String MEDIA = "media";
private static final int LOCAL_AUDIO = 1;
private static final int STREAM_AUDIO = 2;
private static final int RESOURCES_AUDIO = 3;
private static final int LOCAL_VIDEO = 4;
private static final int STREAM_VIDEO = 5;
private boolean mIsVideoSizeKnown = false;
private boolean mIsVideoReadyToBePlayed = false;

/**
 * 
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    mPreview = (SurfaceView) findViewById(R.id.surface);
    holder = mPreview.getHolder();
    holder.addCallback(this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    extras = getIntent().getExtras();

}

private void playVideo(Integer Media) {
   doCleanUp();
    try {
      path = "http://pwserver/barbapappa.mp4";

        // Create a new media player and set the listeners
        mMediaPlayer = new MediaPlayer();
       mMediaPlayer.setDataSource(path);
        mMediaPlayer.setDisplay(holder);
        mMediaPlayer.prepare();
        mMediaPlayer.setOnBufferingUpdateListener(this);
        mMediaPlayer.setOnCompletionListener(this);
        mMediaPlayer.setOnPreparedListener(this);
        mMediaPlayer.setOnVideoSizeChangedListener(this);
        mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
   } catch (Exception e) {
        Log.e(TAG, "PdM error: " + e.getMessage(), e);
    }
}

public void onBufferingUpdate(MediaPlayer arg0, int percent) {
    Log.d(TAG, "onBufferingUpdate percent:" + percent);

}

public void onCompletion(MediaPlayer arg0) {
    Log.d(TAG, "onCompletion called");
}

public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
    Log.v(TAG, "onVideoSizeChanged called");
    if (width == 0 || height == 0) {
        Log.e(TAG, "invalid video width(" + width + ") or height(" + height + ")");
        return;
    }
    mIsVideoSizeKnown = true;
    mVideoWidth = width;
    mVideoHeight = height;
    if (mIsVideoReadyToBePlayed && mIsVideoSizeKnown) {
        startVideoPlayback();
    }
}

public void onPrepared(MediaPlayer mediaplayer) {
    Log.d(TAG, "onPrepared called");
    mIsVideoReadyToBePlayed = true;
    if (mIsVideoReadyToBePlayed && mIsVideoSizeKnown) {
        startVideoPlayback();
    }
}

public void surfaceChanged(SurfaceHolder surfaceholder, int i, int j, int k) {
    Log.d(TAG, "surfaceChanged called");

}

public void surfaceDestroyed(SurfaceHolder surfaceholder) {
    Log.d(TAG, "surfaceDestroyed called");
}


public void surfaceCreated(SurfaceHolder holder) {
    Log.d(TAG, "surfaceCreated called");
    playVideo(extras.getInt(MEDIA));
}

@Override
protected void onPause() {
    super.onPause();
    releaseMediaPlayer();
    doCleanUp();
}

@Override
protected void onDestroy() {
    super.onDestroy();
    releaseMediaPlayer();
    doCleanUp();
}

private void releaseMediaPlayer() {
    if (mMediaPlayer != null) {
        mMediaPlayer.release();
        mMediaPlayer = null;
    }
}

private void doCleanUp() {
    mVideoWidth = 0;
    mVideoHeight = 0;
    mIsVideoReadyToBePlayed = false;
    mIsVideoSizeKnown = false;
}

private void startVideoPlayback() {
    Log.v(TAG, "startVideoPlayback");
    holder.setFixedSize(mVideoWidth, mVideoHeight);
    mMediaPlayer.start();

}

Can somebody check it out and hopefully tell me where I went wrong. I’ve debugging it for hours but with no result. Every help appreciated !


@Dr.Dredel: i don’t know how to do that

Hereby the logcat-contents and thanks for helping:

 D/AndroidRuntime(496): Shutting down VM
 W/dalvikvm(496): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
 E/AndroidRuntime(496): Uncaught handler: thread main exiting due to uncaught exception
 E/AndroidRuntime(496): java.lang.NullPointerException
 E/AndroidRuntime(496):     at org.apache.android.media.VideoViewDemo.surfaceCreated(VideoViewDemo.java:133)
 E/AndroidRuntime(496):     at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
 E/AndroidRuntime(496):     at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
 E/AndroidRuntime(496):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
 E/AndroidRuntime(496):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(496):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
 E/AndroidRuntime(496):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(496):     at android.view.View.draw(View.java:6538)
 E/AndroidRuntime(496):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
 E/AndroidRuntime(496):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
 E/AndroidRuntime(496):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(496):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
 E/AndroidRuntime(496):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(496):     at android.view.View.draw(View.java:6538)
 E/AndroidRuntime(496):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
 E/AndroidRuntime(496):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
 E/AndroidRuntime(496):     at android.view.ViewRoot.draw(ViewRoot.java:1349)
 E/AndroidRuntime(496):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
 E/AndroidRuntime(496):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
 E/AndroidRuntime(496):     at android.os.Handler.dispatchMessage(Handler.java:99)
 E/AndroidRuntime(496):     at android.os.Looper.loop(Looper.java:123)
 E/AndroidRuntime(496):     at android.app.ActivityThread.main(ActivityThread.java:4363)
 E/AndroidRuntime(496):     at java.lang.reflect.Method.invokeNative(Native Method)
 E/AndroidRuntime(496):     at java.lang.reflect.Method.invoke(Method.java:521)
 E/AndroidRuntime(496):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
 E/AndroidRuntime(496):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 E/AndroidRuntime(496):     at dalvik.system.NativeStart.main(Native Method)
 I/dalvikvm(496): threadid=7: reacting to signal 3
 E/dalvikvm(496): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
 D/MediaPlayerDemo(521): surfaceCreated called
 D/AndroidRuntime(521): Shutting down VM
 W/dalvikvm(521): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
 E/AndroidRuntime(521): Uncaught handler: thread main exiting due to uncaught exception
 E/AndroidRuntime(521): java.lang.NullPointerException
 E/AndroidRuntime(521):     at org.apache.android.media.VideoViewDemo.surfaceCreated(VideoViewDemo.java:134)
 E/AndroidRuntime(521):     at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
 E/AndroidRuntime(521):     at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
 E/AndroidRuntime(521):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
 E/AndroidRuntime(521):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(521):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
 E/AndroidRuntime(521):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(521):     at android.view.View.draw(View.java:6538)
 E/AndroidRuntime(521):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
 E/AndroidRuntime(521):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
 E/AndroidRuntime(521):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(521):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
 E/AndroidRuntime(521):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
 E/AndroidRuntime(521):     at android.view.View.draw(View.java:6538)
 E/AndroidRuntime(521):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
 E/AndroidRuntime(521):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
 E/AndroidRuntime(521):     at android.view.ViewRoot.draw(ViewRoot.java:1349)
 E/AndroidRuntime(521):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
 E/AndroidRuntime(521):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
 E/AndroidRuntime(521):     at android.os.Handler.dispatchMessage(Handler.java:99)
 E/AndroidRuntime(521):     at android.os.Looper.loop(Looper.java:123)
 E/AndroidRuntime(521):     at android.app.ActivityThread.main(ActivityThread.java:4363)
 E/AndroidRuntime(521):     at java.lang.reflect.Method.invokeNative(Native Method)
 E/AndroidRuntime(521):     at java.lang.reflect.Method.invoke(Method.java:521)
 E/AndroidRuntime(521):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(521):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime(521):  at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(521): threadid=7: reacting to signal 3
E/dalvikvm(521): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
I/Process(521): Sending signal. PID: 521 SIG: 9
D/MediaPlayerDemo(547): surfaceCreated called
D/AndroidRuntime(547): Shutting down VM
W/dalvikvm(547): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/AndroidRuntime(547): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(547): java.lang.NullPointerException
E/AndroidRuntime(547):  at org.apache.android.media.VideoViewDemo.surfaceCreated(VideoViewDemo.java:134)
E/AndroidRuntime(547):  at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
E/AndroidRuntime(547):  at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
E/AndroidRuntime(547):  at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
E/AndroidRuntime(547):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
E/AndroidRuntime(547):  at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
E/AndroidRuntime(547):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
E/AndroidRuntime(547):  at android.view.View.draw(View.java:6538)
E/AndroidRuntime(547):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
E/AndroidRuntime(547):  at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
E/AndroidRuntime(547):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
E/AndroidRuntime(547):  at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
E/AndroidRuntime(547):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
E/AndroidRuntime(547):  at android.view.View.draw(View.java:6538)
E/AndroidRuntime(547):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
E/AndroidRuntime(547):  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
E/AndroidRuntime(547):  at android.view.ViewRoot.draw(ViewRoot.java:1349)
E/AndroidRuntime(547):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
E/AndroidRuntime(547):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
E/AndroidRuntime(547):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(547):  at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(547):  at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime(547):  at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(547):  at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(547):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(547):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime(547):  at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(547): threadid=7: reacting to signal 3
E/dalvikvm(547): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
I/Process(547): Sending signal. PID: 547 SIG: 9
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:12:25+00:00Added an answer on May 31, 2026 at 10:12 am

    I’ve face the same problem today.

    All I needed to do, was to remove the parameter of the playVideo method and to update the surfaceCreated method by removing the “extras.getInt()”.

    By doing this I can play video but I still don’t know what the extras is used for…

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.