java.lang.NullPointerException

Appcelerator JIRA | Caleb Cox | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    After closing the last window on Android, when attempting to open a new window, the app crashes with the "Unfortunately app has stopped" message. Here is the stack trace that I get: {noformat} E/AndroidRuntime( 2450): FATAL EXCEPTION: main E/AndroidRuntime( 2450): Process: com.appdev.test, PID: 2450 E/AndroidRuntime( 2450): java.lang.NullPointerException E/AndroidRuntime( 2450): at android.content.ComponentName.<init>(ComponentName.java:77) E/AndroidRuntime( 2450): at android.content.Intent.<init>(Intent.java:3813) E/AndroidRuntime( 2450): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:128) E/AndroidRuntime( 2450): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88) E/AndroidRuntime( 2450): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:399) E/AndroidRuntime( 2450): at android.os.Handler.dispatchMessage(Handler.java:98) E/AndroidRuntime( 2450): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime( 2450): at android.app.ActivityThread.main(ActivityThread.java:5017) E/AndroidRuntime( 2450): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 2450): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime( 2450): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) E/AndroidRuntime( 2450): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) E/AndroidRuntime( 2450): at dalvik.system.NativeStart.main(Native Method) {noformat} Here is the test case that I am using: {code:javascript} var openWindow = function(index) { var window = Ti.UI.createWindow({ backgroundColor: 'white', title: 'Window ' + index }); var button = Ti.UI.createButton({ width: 80, height: 40, title: 'Button' }); button.addEventListener('click', function() { window.close(); openWindow(index + 1); }); window.add(button); window.open(); }; openWindow(1); {code} It successfully closes the first window but crashes when attempting to open the second window. It works when opening the second window before closing the first.

    Appcelerator JIRA | 2 years ago | Caleb Cox
    java.lang.NullPointerException
  2. 0

    After closing the last window on Android, when attempting to open a new window, the app crashes with the "Unfortunately app has stopped" message. Here is the stack trace that I get: {noformat} E/AndroidRuntime( 2450): FATAL EXCEPTION: main E/AndroidRuntime( 2450): Process: com.appdev.test, PID: 2450 E/AndroidRuntime( 2450): java.lang.NullPointerException E/AndroidRuntime( 2450): at android.content.ComponentName.<init>(ComponentName.java:77) E/AndroidRuntime( 2450): at android.content.Intent.<init>(Intent.java:3813) E/AndroidRuntime( 2450): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:128) E/AndroidRuntime( 2450): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88) E/AndroidRuntime( 2450): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:399) E/AndroidRuntime( 2450): at android.os.Handler.dispatchMessage(Handler.java:98) E/AndroidRuntime( 2450): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime( 2450): at android.app.ActivityThread.main(ActivityThread.java:5017) E/AndroidRuntime( 2450): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 2450): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime( 2450): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) E/AndroidRuntime( 2450): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) E/AndroidRuntime( 2450): at dalvik.system.NativeStart.main(Native Method) {noformat} Here is the test case that I am using: {code:javascript} var openWindow = function(index) { var window = Ti.UI.createWindow({ backgroundColor: 'white', title: 'Window ' + index }); var button = Ti.UI.createButton({ width: 80, height: 40, title: 'Button' }); button.addEventListener('click', function() { window.close(); openWindow(index + 1); }); window.add(button); window.open(); }; openWindow(1); {code} It successfully closes the first window but crashes when attempting to open the second window. It works when opening the second window before closing the first.

    Appcelerator JIRA | 2 years ago | Caleb Cox
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NullPointerException

    No message provided

    at android.content.ComponentName.<init>()
  2. Android Platform
    Intent.<init>
    1. android.content.ComponentName.<init>(ComponentName.java:77)
    2. android.content.Intent.<init>(Intent.java:3813)
    2 frames
  3. ti.modules.titanium
    WindowProxy.handleOpen
    1. ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:128)
    1 frame
  4. org.appcelerator.titanium
    TiWindowProxy.handleMessage
    1. org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88)
    1 frame
  5. ti.modules.titanium
    WindowProxy.handleMessage
    1. ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:399)
    1 frame
  6. Android Platform
    ActivityThread.main
    1. android.os.Handler.dispatchMessage(Handler.java:98)
    2. android.os.Looper.loop(Looper.java:136)
    3. android.app.ActivityThread.main(ActivityThread.java:5017)
    3 frames
  7. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:515)
    2 frames
  8. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    2 frames
  9. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame