Closed fwhenin closed 9 years ago
Update: I got it not to crash..but still a null image gets passed
You should save the image path, and re-initialize it with that. This should fix it.
filePath = imageChooserManager.choose();
imageChooserManager.reinitialize(filePath);
well the filePath during reinitialize is null for both after the user selects or captures an image
''' private void reinitializeImageChooser() { imageChooserManager = new ImageChooserManager(this, chooserType, "AutosoftFlexMobile", false); imageChooserManager.setImageChooserListener(this); imageChooserManager.reinitialize(imageChooser); // imageChooser here is always null } '''
Could you try the sample app and see if it's still the same problem? If yes, then I can look into this.
I tried it...and it works there. but my code is inside a fragment not an activity
this is definitely something I'm doing, I just don't know what it is lol
Ok, So, first thing, is probably because your activity is being destroyed. When you call this,
filePath = imageChooserManager.choose();
Can you check if at this point, it is null in the logs?
it's not null there...it's null at reinitialize
I'm looking now into using onSaveInstanceState and saving it there.
GOT IT
''' @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState);
outState.putString("imageChooser", imageChooser);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null){
imageChooser = savedInstanceState.getString("imageChooser", null);
}
}
'''
had to save the imageChooser and get it from the instancestate
my code for the two is very similar
So everything is good for picking a picture from gallery, but when I use the camera, I take a picture, hit 'Save' then it goes to a blank screen, the reason is 'Couldn't process a null file' then the app crashes. any help would be great