Skip to content Skip to sidebar Skip to footer

Gems App - Live Stream Fragment

While developing a Gems app with the help of Fragments,logcat error occurred at runtime. LogCat: E/AndroidRuntime(667): FATAL EXCEPTION: main E/AndroidRuntime(667): java.lang.Nul

Solution 1:

Check your appData object and ensure it has been initialized. This looks like it is either null or is returning a null URL string.


Solution 2:

Looking at the line of code causing the problem, it doesn't look like you've initialized the appData instance anywhere, could this be why?

If this is not the problem, you could narrow the problem down or temporarily patch the problem by replacing this:

bundle.putString("url", appData.getLiveStreamVideo().getVideoUrl());

With this:

try {
    Log.d("LiveStreamVideo", "Screen Width: " + appData.getScreenWidth());
    Log.d("LiveStreamVideo", "Video URL: " + getLiveStreamVideo().getVideoUrl());
    bundle.putString("url", appData.getLiveStreamVideo().getVideoUrl());
} catch (Exception e) {
    e.printStackTrace();
}

If outputs the stack trace before you expect to see the first Log output, you know that appData is null. If it fails on the second log request, then getVideoUrl() is the problem.

It could be that getVideoUrl() is returning null as I can't see that it exists with any certainty. Maybe set a default value for this variable just to be sure:

private videoUrl = "";

Post a Comment for "Gems App - Live Stream Fragment"