A few weeks ago, early on a quiet Sunday morning, I felt the familiar buzz in my pocket that means someone had posted a comment in one of my BBM groups. With an ease born of inestimable hours of experience, I whipped out my BlackBerry to mock the person who was wasting their weekend morning by being awake.
The mocking never actually happened; as I read the BBM group post from Brian, I decided that the idea was quite good, and worth discussion (Brian also lives 2 time zones over for me, so mocking him for being awake wouldn't have made much sense).
"Hey, my wife got this really cool game on her phone where you guess a word based on pictures. There isn't anything like that for BlackBerry, why don't we make one?"
We decided to make the BB10 version in Cascades (which is what Brian uses, because it's absolutely amazing for BlackBerry), and the PlayBook version in WebWorks (which is what I use, because it's not quite as amazing for BlackBerry as Cascades yet (but close), but is amazing in general). After over a week of intensive coding, development, and testing, Visual Connection was born.
//End fancy sentimental backstory.
1. First, get slightly familiar with bbUI. If you've never heard of bbUI, check out https://github.com/blackberry/bbUI.js.
2. Next, create your template. In the example, the template is called screen.html. You'll use bb.pushScreen('page',''id') to load it.
if (id == 'page1') element.getElementById('pagetext').innerHTML = "You loaded screen.html with a page ID of 'page1'. Yay!"
if (id == 'page2') element.getElementById('pagetext').innerHTML = "This time, you loaded screen.html with a page ID of 'page2'. See how it's different?"
(because we're using onscreenready, we use element instead of document).
5. Run your app!
As you can see, it's a fairly simple process that can be used to help keep the size of your app more manageable.
Download the dynamic-bbUI sample
If you want to read about the Cascades version of Visual Connection, check out Brian's BBCascades blog post.
Co-founder and legal nay-sayer of OSBB. Owner of SCrApps Application Development, WebWorks aficionado, Open Source contributor. SCrid2000 on most blogs. I build awesome BlackBerry apps when I'm not doing legal work or spending time with my wife and two boys.
Follow me on Twitter - @GShaneC
Check out my apps in BlackBerry WorldWebsite: SCrApps.org