代码:
public int mp3DownLoad(String urlName , String fileName , String path){
InputStream in = null;
try{
WirteTOSDcard wts = new WirteTOSDcard();
if(wts.isFileExists(fileName, path)){
return 0;
}else{
in = httpGet(urlName);
File fileResult = wts.wirteTOsd(fileName, path, in);
if(fileResult == null){
return -1;
}
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}finally{
try {
in.close(); //错误指向这一行,空指针异常。
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return 1;
}
public int mp3DownLoad(String urlName , String fileName , String path){
InputStream in = null;
try{
WirteTOSDcard wts = new WirteTOSDcard();
if(wts.isFileExists(fileName, path)){
return 0;
}else{
in = httpGet(urlName);
File fileResult = wts.wirteTOsd(fileName, path, in);
if(fileResult == null){
return -1;
}
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}finally{
try {
in.close(); //错误指向这一行,空指针异常。
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return 1;
}
解决方案 »
- 菜鸟请教一个简单的问题....
- 自定义ScrollView后,使用onDraw里面的canvas进行绘图后导致ScrollView无法滚动。
- Android初学 急求为何?
- 为什么我每次在Eclipse中点运行,都会新启动一个模拟器?
- 如何获取Activity由谁创建? (比较菜的问题)
- BroadcastReceiver 启动 Server 中的 Context 问题
- android 系统开发, 添加多分辨率选择功能
- 安卓设定多个闹钟 怎么实现
- Android Bootstrap 怎么用?可以在eclipse 中使用吗?
- imageview 的问题 整了好久没解决 sdk版本问题
- android 如何原样显示word文件里面的内容(表格,自选图形,图片,页眉,页脚)
- webview中页面元素焦点设置问题
if(in != null) {
in.close(); //错误指向这一行,空指针异常。
}