Sure, I can do that! The main thing was looking at the dictionary and finding out that it had most of the code available as an example. I read through a few other LCB tutorials out there (mainly
this one and
this one)
I looked through them on how to create a widget, and how it differed to a library, and started to make my own library. The first issue I came across was that while every other module was listed as com.livecode.blah blah blah, the Android Utilities module, which is what this is all based on, was not, so I had to do a little bit of digging in the files of the other extensions to find out what it was called.
Once that was done, I had a test library that wouldn't instantly error out when trying to use the modules needed, and I was on my way to victory!
Until, failure! That's where this thread came in. I saw the dictionary saying that I needed to run some code on open, but wasn't sure how to actually call that on open code (turns out I tried just about everything *except* the right way... go figure!)
I did some thinking and working things out, and was able to get it to call a different handler (which I called TestHandler - very original, I know!) to try and communicate with LCS. I used the resources to get it to first return a string, that I used in an answer(TestHandler()) type command, then changed it to get the string and run it using either do, post or send (I can't 100% remember at this stage what I used, but I think it was send)
After a few more replies and failures of trying to get the on open handler to work, Paul came in and saved the day - with his help I was able to get the code to register code when it was opened, which was amazing! After that was working, I was getting another error (it was a silly one from all my testing; I had accidentally deleted some parts of the code that was in the dictionary and forgot about it), and that's where Mark came in and saved the day again! With his help, I was able to run the code without any error, and after some more tweaking, I had my 'a-ha' moment when I tried to run my openCard script and the error in the LC IDE was that it was missing something Android related. I compiled it and tested it on my phone, and it all came together. Finally, I paused my app, and bam! It was working!
At this stage it was 100% working, but I was getting some behaviour that I thought was an error - keep reading the rest of the thread to see what it was, but since I'm still new to all this, I didn't have a good way to test if it was working or not, until Mark came back and saved it all again with a great test to prove it was working.
After that, all that was left was to write all the documentation, package it up, sign up for a developer ID with LC, upload it and charge $1 billion per download
![Smile :)](./images/smilies/icon_smile.gif)
. Simple, really!
Hopefully this was a good insight as to what was happening as I was making it all, and if you have any questions about the process, let me know and hopefully I can help
Good luck with future extension codings!