Skip to content Skip to sidebar Skip to footer

Android App Error Nullpointerexception?

I am trying to make an android app that when a button is clicked goes into the phones' directory and can open a file. Here is the code I have so far: package com.open1; import jav

Solution 1:

Your method

private File getFilesDir() {
            // TODO Auto-generated method stubreturnnull;
        }

returns null whose return value is then used here:

Filelister=this.getFilesDir();
            ...
>>>>        for (String list : lister.list()){

You are obviously referencing an object (here: lister) that has been initialized with null.

Care to use a debugger and/or working on your TODO comments?

Post a Comment for "Android App Error Nullpointerexception?"