Camera and Image Gallery for iOS and AndroidMonkey Programming Forums/User Modules/Camera and Image Gallery for iOS and Android
| This is based off the Android module by:|
I have added iOS support:
| I'm interested in playing around with the camera function on Android. I haven't touched Monkey-X in probably 12 months, can anyone post a quick example of how I use this module? Sorry I'm still very new to Monkey even though I've had it for a couple of years, and external modules scare me somewhat :)|
I want to be able to take a picture, then let the user decide if the picture is suitable in which case keep it, if not then ditch the picture and allow them to take another one?
| Hi, download the whole repository from GitHub and put it in a folder called camera in your Monkey modules folder, examples are included. |
I could have probably worked it out, just had a quick look while working and didn't have time to explore too much. I'll hopefully give it a go in the next couple of days.
| Finally got around to downloading this to have a play.|
I haven't used Monkey in ages, so hopefully I'm only doing someghinb simple that is making this not work.
Info: Running Monkey 84e
IDE: Jungle IDE
Downloaded the full repository, and put it in the modules/camera directory as advised
Updated the Monkey Modules Database in Jungle - the new module now appears in the help.
As soon as I try to run any of the examples, I get an error:
Type 'IOnImagePickComplete' not found
Any ideas what I'm doing wrong?
| *BUMP* Anyone? |
| Are you building for a supported target ios/android? |
| Yep, building for Android.|
Just tried again, building using Monkey 84e, Android (Api 10), same error message whether I try to build or run in either debug or release mode.
| I will take a look.|
edit: Android compiles without issues.
Have you copied it to the right place? Folder structure:
Can you post the complete build error log please? Is your Android SDK up to date?
| I had my stuff in monkey/modules/bdm-master/camera which was how it unzipped, didn't know it had to go in modules_ext folder. Have since moved it all, to reflect exactly what you have.|
Yes, the Android SDK should be up to date - had to reconfigure Jungle IDE when I downloaded Monkey 84e and I just got it to redownload the SDK, Java etc.
format_code('C:\monkey84e\MonkeyXPro84e\Bin\transcc_winnt.exe -build -config=debug -target=Android_Game_(Api_10) "C:/monkey84e/MonkeyXPro84e/modules_ext/camera/examples/camerapicker_01.monkey"
TRANS monkey compiler V1.85
C:/monkey84e/MonkeyXPro84e/modules_ext/camera/examples/camerapicker_01.monkey<20> : Error : Type 'IOnCameraPickComplete' not found
Abnormal program termination.
Exit code: -1
| Can you share your example code please? It can't be the original, because there is no "IOnCameraPickComplete" in line 20. |
| This is the exact code from the example that I unzipped, and it is in fact line 20:|
Title: CameraPicker example 1 - Open camera and load it in monkey
Description: Open camera and load it into monkey.
Author: Dominik Kollon
Class MyApp Extends App Implements IOnCameraPickComplete
camerapicker = New CameraPicker
camerapicker.SetScaleType(2) ' Scale the image to fit in width and height
camerapicker.SetImageSize(DeviceWidth(), DeviceHeight()) ' Scale image to the devices resolution
If TouchDown() Then
If camerapicker.HasCamera() Then camerapicker.OpenCameraPickerAsync("test", Self) ' Check if device has camera, if so open the camera
If result <> "" Then
myimage = LoadImage(result)
p.s. thanks for your help trying to get this issue sorted out.
Unless I've somehow managed to download something different, can you post the code you have and maybe it will clear up what is going wrong.
| Your problem is here:|
(or whatever your folder structure is in the modules folder)
It simply can't find the module in the path you've given. Your path is set to:
I guess in this folder there is no camerapicker.monkey. BTW: it makes no difference if you put it into the modules or modules_ext folder. It's just a convinient way to put it into the _ext folder.
BTW: I've used this repo: https://github.com/CopperCircle/Camera
Download it from there, it works out of the box.
| That fixed it - well it builds, don't have my Android Tablet with me atm to see what it does, but it builds successfully. You're a champ.|
So actually your folder structure is NOT like the one I've posted above.
Sorry, I thought I made it clear that I moved everything to different directories that matched what you posted thinking that that may have somehow caused my issues.
I downloaded the first link which is where a lot/all of the trouble was.
Thanks again for helping me out. Will try and have a play tomorrow to see how it all works.