Closed cesine closed 12 years ago
2: the onActivityResult is a pretty awesome pattern to have in your tool belt.
Basically if you need to go out of your activity for a bit to check something (in this case, to let the user change the settings) then you will come back into your activity in the onActivityResult hook. This is where you can create a case statement for each time you leave (in this case we leave twice, once to turn on the GPS if it was turned off, and then secondly to the camera app to take a picture) then we come back and process it. Needing the onActivityResult hook is frequent in Android because we call intents to other modules to do small well defined tasks, like take a picture.
Might still need some code review from GPS expert...but for now it works well enough
Integrating checking the GPS in the TakePicture activity was actually pretty complicated and needed some complex Android Architecture stuff.
1: initialize stuff in the onCreate method in Activities (stuff you would normally put in a constructor, you can normally put here) https://github.com/AndroidImageProcessing/AndroidBacteriaImageProcessing/commit/e8cb6af4c65da4ece527b172dd1254045776379e