You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File dialog crashes with NullPointerException if dirPath does not exists.
03-10 18:15:17.289: ERROR/AndroidRuntime(1438): Caused by:
java.lang.NullPointerException
03-10 18:15:17.289: ERROR/AndroidRuntime(1438): at
com.loudsoft.loudbook.FileDialog.getDirImpl(FileDialog.java:177)
03-10 18:15:17.289: ERROR/AndroidRuntime(1438): at
com.loudsoft.loudbook.FileDialog.getDir(FileDialog.java:137)
03-10 18:15:17.289: ERROR/AndroidRuntime(1438): at
com.loudsoft.loudbook.FileDialog.onCreate(FileDialog.java:125)
03-10 18:15:17.289: ERROR/AndroidRuntime(1438): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-10 18:15:17.289: ERROR/AndroidRuntime(1438): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
I offer this solution:
private void getDirImpl(String dirPath) {
File f = new File(dirPath);
// Use root directory if dirPath does not exists
if(!f.exists())
{
Toast.makeText(context, "There is no such directory " + dirPath, duration).show();
dirPath = root;
f = new File(root);
}
myPath.setText(getText(R.string.location) + ": " + dirPath);
currentPath = dirPath;
item = new ArrayList<String>();
path = new ArrayList<String>();
mList = new ArrayList<HashMap<String, Object>>();
File[] files = f.listFiles();
Такие дела =)
Original issue reported on code.google.com by ppv....@gmail.com on 10 Mar 2011 at 3:31
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
ppv....@gmail.com
on 10 Mar 2011 at 3:31The text was updated successfully, but these errors were encountered: