i want to ask about error of my project. My project (add data) have a uploading image function, when i not uploading the image, why my project get error ???
It's my script
for(int x = 0; x < 1; x++){
String outFileName = DB_Path + sNama + x + ".jpg";
InputStream myinput = null;
try{
myinput = getContentResolver().openInputStream(selectedImage[x]);
}catch(FileNotFoundException e){
//e.printStackTrace();
}
OutputStream myoutput = null;
try{
myoutput = new FileOutputStream(outFileName);
}catch(FileNotFoundException e){
e.printStackTrace();
}
try{
IOUtils.copy(myinput, myoutput);
}catch(InterruptedException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
try{
myinput.close();
}catch(IOException e){
e.printStackTrace();
}
f1 = sNama = "_" + x + ".jpg";
sFoto1 = sNama + "_" + 0 + ".jpg";
}
}
and it's the error
11-18 13:20:45.855: E/AndroidRuntime(1214): java.lang.NullPointerException 11-18 13:20:45.855: E/AndroidRuntime(1214): at android.content.ContentResolver.openInputStream(ContentResolver.java:303)
error is
myinput = getContentResolver().openInputStream(selectedImage[x]);