I have the application to take the photo and send it to server. The taking photo and server(accept image) run perfectly separately. When I try to use below code after taking photo to send server, it causes to force to close the application. Here is the code:
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if (resultCode == RESULT_OK){
Uri imageUri=data.getData();
List<NameValuePair> params = new ArrayList<NameValuePair>(1);
params.add(new BasicNameValuePair("image", imageUri.getPath()));
post("http://myserver-address",params);
}
}
post method is same as Sending images using Http Post
Log cat says:
java.lang.RuntimeException: Unable to resume activity
{com.john.smith/com.john.smith.Activity}: java.lang.RuntimeException:
Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null}
to activity {com.john.smith/com.john.smith.Activity}:
java.lang.NullPointerException
I think, there is something wrong for passing parameters to send function. Because, I try disable all the lines in my send function, still face the error. And this error causes to force the application close.
How can I fix that problem ? How to pass the photo to send
function other than mine ?
Update:
my camera capture code is same as http://code.google.com/p/crw-cmu/source/browse/luis/PhotoIntentActivity/src/com/example/android/photobyintent/PhotoIntentActivity.java?r=734
I call it like that
protected void onActivityResult(int requestCode, int resultCode, Intent data){
switch (requestCode) {
case ACTION_TAKE_PHOTO_B: {
if (resultCode == RESULT_OK) {
handleBigCameraPhoto();
Uri imageUri=data.getData();
List<NameValuePair> params = new ArrayList<NameValuePair>(1);
params.add(new BasicNameValuePair("image", imageUri.getPath()));
post("http://myserver-address",params);
}
}
break;
} // ACTION_TAKE_PHOTO_B
} // switch
}