if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ File parent = Environment.getExternalStorageDirectory(); downloadFile = new File(parent,fileName); out = new FileOutputStream(downloadFile); }
downloadFile = new File(parent,fileName);
out = new FileOutputStream(downloadFile);
}[/code]downloadFile可能没有生成;还有就是downloadFile是不是需要判断一下是否不存在然后调用createNewFile()方法
那是这么写吗?
downloadFile = new File(parent,fileName);
if(downloadFile == null){
downloadFile.createNewFile();
}
out = new FileOutputStream(downloadFile);
但是报错,怎么搞。我的外置存储卡好像本来就打不开,不知道是不是权限的原因,要改adb命令
downloadFile = new File(parent,fileName);
out = new FileOutputStream(downloadFile);
}[/code]downloadFile可能没有生成;还有就是downloadFile是不是需要判断一下是否不存在然后调用createNewFile()方法
那是这么写吗?
downloadFile = new File(parent,fileName);
if(downloadFile == null){
downloadFile.createNewFile();
}
out = new FileOutputStream(downloadFile);
但是报错,怎么搞。我的外置存储卡好像本来就打不开,不知道是不是权限的原因,要改adb命令
不行啊
09-18 07:03:27.379: D/dalvikvm(854): GC_FOR_ALLOC freed 41K, 6% free 2693K/2852K, paused 81ms, total 84ms
09-18 07:03:27.379: I/dalvikvm-heap(854): Grow heap (frag case) to 3.348MB for 635812-byte allocation
09-18 07:03:27.449: D/dalvikvm(854): GC_FOR_ALLOC freed 2K, 5% free 3311K/3476K, paused 61ms, total 61ms
09-18 07:03:27.909: W/dalvikvm(854): threadid=15: thread exiting with uncaught exception (group=0x414c4700)
09-18 07:03:27.909: E/AndroidRuntime(854): FATAL EXCEPTION: Thread-82
09-18 07:03:27.909: E/AndroidRuntime(854): java.lang.NullPointerException
09-18 07:03:27.909: E/AndroidRuntime(854): at com.hao123.http_01.HttpThread.run(HttpThread.java:67)
09-18 07:03:27.969: I/Choreographer(854): Skipped 65 frames! The application may be doing too much work on its main thread.
09-18 07:03:28.179: D/gralloc_goldfish(854): Emulator without GPU emulation detected.
09-18 07:03:31.409: I/Choreographer(854): Skipped 30 frames! The application may be doing too much work on its main thread.
09-18 07:03:34.060: I/Process(854): Sending signal. PID: 854 SIG: 9
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ File parent = Environment.getExternalStorageDirectory(); downloadFile = new File(parent,fileName); out = new FileOutputStream(downloadFile); }
downloadFile = new File(parent,fileName);
out = new FileOutputStream(downloadFile);
}[/code]downloadFile可能没有生成;还有就是downloadFile是不是需要判断一下是否不存在然后调用createNewFile()方法
那是这么写吗?
downloadFile = new File(parent,fileName);
if(downloadFile == null){
downloadFile.createNewFile();
}
out = new FileOutputStream(downloadFile);
但是报错,怎么搞。我的外置存储卡好像本来就打不开,不知道是不是权限的原因,要改adb命令
downloadFile = new File(parent,fileName);
out = new FileOutputStream(downloadFile);
}[/code]downloadFile可能没有生成;还有就是downloadFile是不是需要判断一下是否不存在然后调用createNewFile()方法
那是这么写吗?
downloadFile = new File(parent,fileName);
if(downloadFile == null){
downloadFile.createNewFile();
}
out = new FileOutputStream(downloadFile);
但是报错,怎么搞。我的外置存储卡好像本来就打不开,不知道是不是权限的原因,要改adb命令
不行啊
09-18 07:03:27.379: D/dalvikvm(854): GC_FOR_ALLOC freed 41K, 6% free 2693K/2852K, paused 81ms, total 84ms
09-18 07:03:27.379: I/dalvikvm-heap(854): Grow heap (frag case) to 3.348MB for 635812-byte allocation
09-18 07:03:27.449: D/dalvikvm(854): GC_FOR_ALLOC freed 2K, 5% free 3311K/3476K, paused 61ms, total 61ms
09-18 07:03:27.909: W/dalvikvm(854): threadid=15: thread exiting with uncaught exception (group=0x414c4700)
09-18 07:03:27.909: E/AndroidRuntime(854): FATAL EXCEPTION: Thread-82
09-18 07:03:27.909: E/AndroidRuntime(854): java.lang.NullPointerException
09-18 07:03:27.909: E/AndroidRuntime(854): at com.hao123.http_01.HttpThread.run(HttpThread.java:67)
09-18 07:03:27.969: I/Choreographer(854): Skipped 65 frames! The application may be doing too much work on its main thread.
09-18 07:03:28.179: D/gralloc_goldfish(854): Emulator without GPU emulation detected.
09-18 07:03:31.409: I/Choreographer(854): Skipped 30 frames! The application may be doing too much work on its main thread.
09-18 07:03:34.060: I/Process(854): Sending signal. PID: 854 SIG: 9