Note that there are some explanatory texts on larger screens.

plurals
  1. PONullPointer exception and FileInputStream
    text
    copied!<p>I have a NPE when I execute the line <code>FileInputStream ifs=openFileInput(fileName);</code> I get a NPE. I get the same NPE when I execute </p> <p><code>FileInputStream ifs=getApplicationContext().openFileInput(fileName);</code></p> <p>The full stacktrace is here.</p> <pre><code>07-25 22:00:35.852 25063-25063/? E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NullPointerException at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:109) at com.ollien.flashcarder.MainActivity.setPagerFile(MainActivity.java:353) at com.ollien.flashcarder.SetsFragment$1.onItemClick(SetsFragment.java:47) at android.widget.AdapterView.performItemClick(AdapterView.java:298) at android.widget.AbsListView.performItemClick(AbsListView.java:1215) at android.widget.ListView.performItemClick(ListView.java:4506) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2959) at android.widget.AbsListView$1.run(AbsListView.java:3645) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:5751) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>Could someone help? I don't quite know why this is happening. fileName is not null, and is equal to <code>"hi there.txt"</code>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload