Saturday, September 4, 2010

Palm Developer Blog: Developing Cross Platform Apps with PhoneGap: Part 1

Posted: 03 Sep 2010 12:22 PM PDT

Introducing PhoneGap

When you build an application for a mobile device you usually build it using the SDK specifically for that platform. This gives you a completely native look and feel, as well as full access to features specific to that device or operating system. Sometimes, however, you don’t need full device access. Sometimes you might want code at a very high level using just web standards and be able to run the application on multiple OSes.
 This is similar to coding a mobile website, except that as an local application your app can launch faster, work offline, and have access to local resources.

PhoneGap is an open source, cross platform tool for writing code once that runs on multiple mobile platforms using just HTML, JavaScript, and CSS. It is not a full OS toolkit and does not provide GUI widgets or high level features. It’s simply a common API and set of build tools that give you have uniform access to the browser and device services.
This is part one of a series on using PhoneGap to build apps for webOS and other mobile operating systems like iPhone and Android. In this first part we will build a simple webOS app using PhoneGap and HTML Canvas; no webOS specific APIs. In future parts of the series we will port this same application to Android and iPhone.

Note: this tutorial assumes you have already downloaded the Palm webOS SDK for free from developer.palm.com. See this article for full instructions.

Setting up PhoneGap

Go to www.phonegap.com, click ‘download phone gap‘, to get the latest release (0.9.1 at the time of this writing).

You will get a zip file containing a bunch of directories, one for each platform. Put this in a safe place. You will use it as the clean base for all of your apps.
Make a copy of the phonegap-palm directory and rename it for your app. For this blog I’m going to make an app called stars.

From the command line, go into the stars directory and run make clean; make. If you have the emulator open or your webOS device attached via USB then it will successfully build, package, and launch the app. Congrats, you’ve built a phonegap app that perfectly does nothing. Now let’s make it useful by drawing a bunch of stars.

The actual app is in framework/www/ directory. Open up framework/www/index.html in your favorite text editor. This is the core of your app.
Put the following code in the header right below the phonegap.js line

    
     
     
        
this will set a few styles and include the starfield.js file where the actual code is.
In the body element put this:
        

Star Field

tap to start

This creates a header and a canvas ready for us to draw into. When you click on the canvas it will call starfieldStart(), which begins
the star simulator. Now let’s put in some real code.
Paste this into a file called Starfield.js
var ctx;var width = 320;
var height = 320;
var partx;
var party;
var partdx;
var partdy;
var PARTS=100;
var count=0;
var ramp=1;
var intervalId;

function circle(x,y,r) {
     ctx.beginPath();
     ctx.arc(x, y, r, 0, Math.PI*2, true);
     ctx.closePath();
     ctx.fill();
};

function draw() {
     ctx.clearStyle = "#000000";
     ctx.clearRect(0,0,width,height);
     ctx.fillStyle = "#000000";
     ctx.fillRect(0,0,width,height);
     ctx.fillStyle = "#FFFFFF";
     for(i=0;i width || partx[i]<0) {
               partx[i] = width/2;
               party[i] = height/2;
          }
     }
     count++;
     if(count > 500) {
          ramp--;
          if(ramp < 1) ramp = 0;
     } else {
          ramp++;
          if(ramp > PARTS) ramp = PARTS;
     }
     if(count > 600) {
          clearInterval(intervalId);
     }
};

function starfieldStart() {
     count = 0;
     ramp = 1;
     ctx = document.getElementById("svgCanvas").getContext("2d");

     partx = new Array(PARTS);
     party = new Array(PARTS);
     partdx = new Array(PARTS);
     partdy = new Array(PARTS);

     for(i=0;i
run ‘make’ and you’ll the app start. click in the middle to start the stars. after a few seconds (technically 600 iterations of the loop) it will end, but you can click to start it again.
palm_emu_running.png
That’s all there is to creating an app with phonegap. Of course, we want to create the best possible experience for our users, so there’s a few things we need to fix. Let’s see if we can make it launch faster and give it a proper name.

Launch Faster

Mojo is the standard Javascript framework that most webOS apps are built with. However, if you aren’t using any features within it then it’s just costing you startup time. You can actually get rid of Mojo by just commenting out the script tag at the top of your index.html page.

Mojo does one thing that we need however. It tells the window manager when we the app is fully loaded and ready to go. We can do this manually with a simple onLoad event handler. Add the following script to the head of the index.html page
then add a call in the body’s onload event.
That’s it. Now the app will load without Mojo and start up very quickly.

A Better Name

Now lets give it a proper name. Edit the appinfo.json file and change the id, version, vendor, and title to something more appropriate.:
{
     "id": "com.palmdts.phonegap.stars",
     "version": "0.0.1",
     "vendor": "Josh Marinacci",
     "type": "web",
     "main": "index.html",
     "title": "Stars",
     "icon": "icon.png"
}
If you change the id or version fields above (which you should) then you’ll need to edit the deploy and run targets in the Makefile as well.

A New Icon

Now we can replace icon.png with a new image. Here’s the one I whipped up in Photoshop.
icon.png
You may need to delete the app from your phone and reinstall it for webOS to pick up the new name and icon.
palm_emu_icon.png

Debugging

If you are having any trouble with your app code you can debug it using two methods. First, most of your code should run perfectly in a modern desktop browser like FireFox or Chrome. Start developing your app in the browser first, and port it to PhoneGap only after the core functionality works. This will give you access to the great debugging tools built into these browsers.
Second, once you have your app running on webOS you can watch the debugging log on the device using the palm-log command.
palm-log -f com.palmdts.phonegap.stars
This will start watching the log so you can see JavaScript errors and your debugging output to the console.

Conclusion

Now we’ve done it: a cross platform canvas app for webOS using PhoneGap. In the next part of this series I’ll show you how to set up the android SDK and run this exact same app on Android with almost no code changes.

  

Alcatel-Lucent makes first LTE call within public safety broadband spectrum

Alcatel-Lucent makes first LTE call within public safety broadband spectrum



Alcatel-Lucent says that it has made industry's first data call using a LTE wireless broadband network operating at Band 14, the spectrum earmarked for public safety agencies in the United States.
The call demonstrates the readiness of the network to support current public safety applications used by police, fire and emergency medical services as well as new applications enabled by wireless broadband.

”This achievement represents an important step toward revolutionizing public safety networks as it establishes the readiness of LTE as a technology to enable broadband data applications,”  said Morgan Wright, Vice President, Global Public Safety Segment at Alcatel-Lucent.  “This call also demonstrates Alcatel-Lucent’s expertise in designing and deploying LTE solutions to address the unique needs of the public safety sector and marks an important milestone in support of the Public Safety solution that Alcatel-Lucent is delivering to this critical market.”

In July 2007, the United States Federal Communications Commission (FCC) revised the 700 MHz band plan and service rules to promote the creation of a nationwide interoperable broadband network for public safety and to facilitate the availability of new and innovative wireless broadband services for consumers.The Commission designated 10 MHz of spectrum (paired 5 MHz carriers) in the upper 700 MHz band for Public Safety Broadband communications. This spectrum, together with the adjacent D block constitutes the 3GPP Band 14.

Friday, September 3, 2010

DataViz, Makers of Documents To Go, apparently acquired and now owned by Research In Motion



DataViz acquired by RIM
DataViz, makers of the popular Documents To Go application, announced sad news today for Palm fans. Though the company started out developing for Palm, they are not going to proceed in developing the Documents To Go solution for Palm WebOS. You can read all about that here.
More interesting than this news from DataViz though is the news they didn't announce..... they were bought by RIM!! Though neither company has publicly announced it (yet), multiple sources have confirmed to us that RIM recently acquired DataViz for a reported $50 million cash (not material to RIM, so they didn't have to disclose it publicly as they have done with other acquisitions like the QNX one). Jump on to LinkedIn and you can also quickly find that lots of former DataViz employees have recently switched up their profiles to Research In Motion as their current employer.
Yet another interesting acquisition by RIM. My guess is this is a bit of an enterprise play - put a BES in your business and every device gets the full version of Documents To Go for free. It would be sweet if that was the case for consumers too!! Add this bit of news to the mix and it's no surprise then that DataViz isn't persuing development for Palm... I'm guessing with time they may start to reduce or phase out work for other non-BlackBerry OEMs too (that one is just a hunch though).
I'd say it's a smart buy for RIM. What do you think?!

via crackberry.com http://crackberry.com/dataviz-makers-documents-go-apparently-acquired-and-now-owned-research-motion

  

Intel Turbo Boost Technology





Intel® Core™ i5 processor

About the Intel® Core™ i5 Processor

Intel® Turbo Boost Technology◊1

Automatically speeds up your processor when your PC needs extra performance—that's smart performance with a speed boost. Available in select models of the Intel® Core™ i5 processor-based systems.

Intel® Hyper-Threading Technology◊2

Features four-way multi-task processing that allows each core of your processor to work on two tasks at the same time, delivering the performance you need for smart multitasking. You and your PC won't be slowed down, regardless of how many applications you have open at once.

Intel® HD Graphics◊3

Intel® HD Graphics provides superb visual performance for sharper images, richer color, and life-like audio and video.◊3 Watch movies and Internet videos in high-definition, play popular game titles, and get full support for Microsoft Windows* 7. It's all built in; no need for an extra add-in video card.

Smarter, faster, and now thinner

With an ultra-thin laptop powered by the Intel® Core™ i5 processor, you’ll boost your performance AND your style. With enhanced battery life and an ultra-sleek design, it’s smart computing that looks as good as it performs.
Experience 4G WiMAX with Intel Inside®

Enjoy broadband Internet all over town with 4G WiMAX

A laptop with an Intel® Core™ processor and 4G WiMAX wireless technology delivers great PC performance with blazing Internet speed that’s four times faster than 3G.◊4 Learn more about WiMAX and find out where you can get it
Get this limited-edition laptop sleeve
by award-winning artist MATTHEW CURRY
Buy any qualifying ultra-thin laptop powered by a smart Intel® Core™ processor and own a laptop sleeve designed by Matthew Curry, while supplies last.


  

Chart: Samsung Galaxy Tab vs iPad

Chart: Samsung Galaxy Tab vs iPad

Related article: http://worldwidegadget.blogspot.com/2010/09/samsung-galaxy-tab-gt-p1000-tablet.html
  

Thursday, September 2, 2010

Samsung Galaxy Tab GT-P1000 (Tablet)







Samsung Galaxy Tab GT-P1000


Samsung GALAXY Tab Opens a New Chapter in Mobile Industry
A New Smart Media Device, surpasses mobile boundaries, allowing you to enjoy more possibilities on the go
01 September 2010
Berlin, Germany, September 2nd, 2010 – Samsung Electronics Co., Ltd, a global leader in mobile technology, today announced the launch of the Samsung GALAXY Tab (Model: GT-P1000). Powered by Android Operating System 2.2, the Samsung GALAXY Tab is the first of the company’s tablet devices, representing a new category of mobile products for Samsung.

The Samsung GALAXY Tab brings together all of Samsung’s leading innovations to provide users with more capabilities while on the move. Consumers are able to experience PC-like web-browsing and enjoy all forms of multimedia content on the perfectly sized 7-inch display, wherever they go. Moreover, users can continuously communicate via e-mail, voice and video call, SMS/MMS or social network with the optimized user interface.

“Samsung recognizes the tremendous growth potential in this newly created market and we believe that the Samsung GALAXY Tab brings a unique and open proposition to market. There is a new and emerging consumer demand that Samsung can satisfy since mobile is in our DNA. This demand continues to grow and develop as users tap its limitless potential,” said JK Shin, President and Head of Mobile Communications Business, Samsung Electronics. “The Samsung GALAXY Tab has been designed to enable consumers to maximize their online experience wherever that may be. The Samsung GALAXY Tab is pushing the market in new directions and Samsung believes this is only the beginning of its innovations as pioneers in smart media devices.”

A new concept of mobility for media
As a new category of device, the Samsung GALAXY Tab brings a wealth of mobile experiences. Its striking 7” TFT-LCD display delivers exciting mobile experience for watching films, viewing pictures, e-reading or sharing documents. In design, its light (380g) build provides perfect portability, with its svelte dimensions making it easy to grip and use. Supporting the latest Adobe Flash Player 10.1, the Samsung GALAXY Tab fully supports swift, seamless viewing of every single page of the web.

The ‘Readers Hub,’ Samsung’s unique e-reading application, provides easy access to a vast digital library – from classical literature to the latest bestsellers and reference materials. At the same time, Samsung unveils ‘Media Hub,’ a gateway to a world of films and videos, and ‘Music Hub,’ an application giving access to a wide range of music tunes.

The Samsung GALAXY Tab has made rich communication truly mobile; it presents a level of converged technology that moves beyond mobile or PC to an entirely new category. Users have new powers to consume, create and communicate from wherever they are.

Powerful, always-on communication
With 3G HSPA connectivity, 802.11n Wi-Fi, and Bluetooth® 3.0, the Samsung GALAXY Tab enhances users’ mobile communication on a whole new level. Video conferencing and push email on the large 7-inch display make communication more smooth and efficient. For voice telephony, the Samsung GALAXY Tab turns out to be a perfect speakerphone on the desk, or a mobile phone on the move via Bluetooth® headset.
Powered by a Cortex A8 1.0GHz application processor, the Samsung GALAXY Tab is designed to deliver high performance whenever and wherever you are. At the same time, HD video contents are supported by a wide range of multimedia formats (DivX, XviD, MPEG4, H.263, H.264 and more), which maximizes the joy of entertainment.

While the front-facing camera allows face-to-face video telephony over 3G, the rear-facing camera captures still images and video that you can edit, upload and share, all without any hassle. As online content explodes, the Samsung GALAXY Tab is the best portable solution for every lifestyle that needs a constant connection.
The Samsung GALAXY Tab will be launched in Europe in mid September, and in other markets including Korea, the US and Asia in coming months. .


Apple iPod Touch 4th Gen Ad



  

Apple iPod Touch, the best gets better



As a portable media player/gaming device/minitablet computer, Apple's iPod Touch has been blowing us away since 2007. The only thing really to say about the fourth-generation model unveiled Wednesday is that it is predictably more awesome, yet still not quite a match for the capabilities of the iPhone 4.

The pricing is the same at the high end, with a 32GB model going for $299, and a 64GB version for $399. The 8GB entry model is $229, which is pricier than the $199 8GB version they kept around last year, but has the advantage of sharing all the same specs as its more expensive siblings. Curiously, a 16GB version isn't in the cards.

As far as design goes, the fourth-generation model is noticeably lighter and thinner than previous generations but still maintains a sturdy feel with curved, chromed steel backing. The curve is a bit less pronounced than the second- and third-generation models, allowing it to lay flat without wobbling, but it still maintains a slimmer taper at the edges than the first-generation version.

The volume rocker is now split into two separate buttons, however, the profile of the buttons is the same as before. The screen lock button is still at the top, though located on the right as opposed to the left side (a win for lefties, maybe?). The black antenna window on the back is gone. Headphone and dock connections are on the bottom where they've always been, only now they're joined by a small speaker grille slit on the left side of the dock connection.

The big news about the new Touch is the addition of two video cameras--one facing the user and one facing out. The front-facing camera is meant for use with Apple's Facetime video chat app (first unveiled with iPhone 4), as well as any supported third-party apps.

 With Facetime on the Touch, users can place or receive video calls to both iPhones or other iPod Touch, using an e-mail address, as opposed to a phone number. In my brief demo using Facetime on the Touch, all of the features I've come to expect from the iPhone 4 were present, including the capability to call in portrait or landscape, switch camera views, and pause video transmission while maintaining a voice connection. The feature can be used with a plug-in headset (not included) or simply with the integrated speaker and microphone. For a device that isn't a phone and can be had for as little as $229, I think that Facetime on the iPod Touch is a unique and noteworthy feature.

The rear-facing camera on the Touch is capable of capturing still images and video up to 720p. It is not, however, identical to the camera on the iPhone 4. It uses a different sensor and there's no flash. It's also incapable of working with the new HDR camera feature being rolled out for the iPhone. Still, it's a welcome addition and opens the door to many more apps and uses.

Under the hood, you have a ton of features carried over from iPhone 4. The processor is the same A4 chip as the iPhone. There's an integrated gyroscope now for more fine-grain gaming control. The Wi-Fi antenna now supports 802.11n at 2.4GHz. And last, but not least, the LCD is the same 3.5-inch "retina" display used on the iPhone 4, sporting a 960x640 resolution.

All that screen resolution comes in handy with Apple's new 99-cent HD TV rentals, which are compatible with the Touch.

Enhanced by Zemanta

INTEL´S BLOG: Technology, the Adult Pacifier

Posted: 31 Aug 2010 10:19 PM PDT
I hope you're enjoying the recent discussion of technology and stress. Below is the second guest blog post written by one of Intel's social scientists. One of Intel's anthropologists, Ken Anderson, discusses the way that people use technology similarly to how babies use pacifiers. As I've mentioned in some of my previous blog posts, Intel has hired a series of brilliant minds to study how people use technology and how it can be used as a stress reliever. Stay tuned for more discussions from our social scientists to come in the following weeks.
For background on Intel's research on technology and stress, check out the blog post "Technology and Stress - The Good, Bad & Ugly."
To read the first post in this series of posts by Intel's social scientists, check out Margie Morris' guest post "Technology as Therapy."

Technology, the Adult Pacifier By Ken Anderson
I was running errands with my daughter, and now I've wound up in a coffee shop waiting for her to call me when she's done shopping for a friend. It's unclear whether she is going to be done in 10 minutes or three hours. I hadn't planned on being stranded in a coffee shop, but here I am; our plans are often interrupted or changed by other people, and we develop situated actions for coping.
I'm doing what a lot of people in the coffee shop are doing - drinking an Americano and hauling out my technology. I've read the New York Times on my phone, updated my Twitter feed, checked my e-mail, and of course taken a few notes on what people in the coffee house are doing (because I am an anthropologist and that is what we do). I feel at peace with my situation because I have what I call my "pacifier" with me, although others might simply call it "technology."
What I've experienced is something we've seen in our research with people around the world -"plastic time." Plastic time is the temporality of modern times; it is a temporality of uncertainty. We tend to get interrupted (ever had a spouse or kids ask you to do something while you were watching TV?), have to switch what we are doing to work around others (like my sitting here in this coffee shop now) or have to deal with time extensions (waiting extra long to see your doctor or to get your driver's license renewed). In short, time has some of the same characteristics of plastic.
Technologies are to Adults as Pacifiers are to Babies
We recently tracked 135 smart phone users over a 6 week period in the United States. Not surprisingly, people were using their phones more for Internet access than for calling. What was surprising to some was that about 25 percent of the time people were just checking their phones' screens and not looking at anything in particular. We learned from talking to participants that they were checking in on their world - their friends. A new behavior of lightly checking in on friends, afforded by the phone, had become habitual. The smart phone was not stressing them out; it was reassuring them. It was their "technological pacifier."
To understand how a smart phone is a pacifier requires an understanding of the shift in how we use our phones. Phones are now our containers for social relationships. Research participants described this to us in a number of ways. For example, a 30-something waitress held up her mobile in her right hand and authoritatively declared "This is my tribe." A 20-something financial investor talked about his phone as the "life support" to his social world. The habitual checking of the phone was repeatedly expressed as a means for people to know what was going on with their friends and family. Knowing we are connected and seeing what friends and family are doing puts people at ease.
Smart phones are not our only technology pacifier - PCs and tablets are too. In a similar study to the one tracking smart phones, we have also tracked notebook, netbook and MID use. In these cases the average time people are on these devices is under 4 minutes a session. People are opportunistically getting on these devices to check the state of their world, whether that is moves in a scrabble game, checking on flight plans for vacation or Facebooking. People are accessing these technologies from the time they get up in the morning until they fall asleep at night, sometimes even falling asleep with the devices. Sure, people are on for longer periods of time, but they are drawn back to the technology for even quick uses to re-center themselves and check on friends.
No one can deny that we are in a time of rapid technological and cultural change that is transforming our lives. Seven years ago, smart phones, iPads, 3D TVs and Kindles were not in our lives, not to mention social websites like Twitter and Facebook. These are enabling changes in how we relate to one another and the rhythms of our lives. But changes are normal. As we know from anthropological studies now and in the past, technology doesn't change us, it is what we do with it - we are agents of change. I saw a recent tweet that captures this notion. Terrisenft (07/27/2010 7:27 PM): "It's as much Twitter's fault you have a short attn span as it is your closet's fault you don't have running shoes." Indeed, technology offers an opportunity to change, but really it is up to us to decide what we do with it; it does not act on us.
-ken
Ken Anderson:
kenmyportraitheadshotDSCB-W_0009.jpg Ken Anderson, a symbolic anthropologist, has been a leader in innovative research of people and their practices and turning those insights into corporate strategy. He is currently working on Intel's strategy for the coming ten years.

  

Palm webos 2.0 a second chance. Rivals you better be worried.

Why WebOS 2.0 Should Have Rivals Worried



An early release of WebOS 2.0 for developers demonstrates that the mobile OS still has some life in it, and indicates that new WebOS devices are on the horizon. Rival platforms should be prepared for another strong player in the smartphone and tablet arenas, and avoid counting WebOS out too quickly.

The information about WebOS 2.0 on the Palm Developer Center site suggests some interesting innovations for the next incarnation of WebOS. Stacks takes the card metaphor from WebOS and groups--or stacks--related cards. Just Type takes the concept of search beyond the universal search model by enabling virtually any task on the phone to be initiated by just starting to type. Exhibition provides creative functions for WebOS devices while they are docked.
Suffice it to say there are some unique features that bring some pizazz to WebOS 2.0, but none of the details for the new WebOS suggest that there is anything groundbreaking about it as a mobile OS. So, should Apple, Google, RIM, or Microsoft even pay attention to WebOS? Rivals don't need to be concerned about WebOS in and of itself, but the combination of WebOS with the marketing and distribution power of HP is another story.
Marketing and distribution often trump engineering and innovation. Many technically superior concepts have gone extinct because they lost the marketing and distribution war: Sega Dreamcast, IBM OS/2, HD DVD are good examples. WebOS could easily join that list, but WebOS 2.0 signals that the mobile OS isn't ready to throw in the towel just yet.
Some have argued (and many still do) that WebOS is a technically superior mobile operating system than Apple's iOS, Google's Android, or any other smartphone OS on the market. Whether or not that is true, Palm was unsuccessful at taking any significant chunk of the smartphone market and was eventually bought by HP.
Now, WebOS has a second chance--and this time it has the marketing credibility and established sales and distribution channels of HP on its side. An excellent technology with poor marketing is doomed. A poor technology with excellent marketing can succeed. An innovative technology with superior marketing is virtually guaranteed.
Even more than competing smartphones, rival tablet platforms should keep an eye on WebOS 2.0. HP has already revealed that a WebOS tablet is being developed, and the elements of WebOS that make it such a solid mobile OS for smartphones will make it an even better mobile OS for tablets. A WebOS tablet--especially a WebOS tablet with an HP brand and marketing budget--will be a formidable challenger for the iPad and the emerging stable of Android tablets.
WebOS 2.0 is expected to be available by the end of this year. There are nohardware specs for new WebOS smartphones, tablets, or other devices yet, but, its coming soon and competing platforms have reason to be concerned.

  

Palm Developer Blog: Dynamic Widget Instantiation


Posted: 01 Sep 2010 05:40 PM PDT
Have you ever needed to set up a Mojo widget sometime after a scene’s setup method has been called? Perhaps you aren’t ready or don’t want the overhead of setting your widget up when the scene first loads. Or maybe you’re waiting until some condition has been met, such as the activate method being called after a scene above is popped. Or maybe you want to do something fancy like create an engine that programmatically populates a scene & its widgets at any point in a scene’s lifecycle.
Well, the instantiateChildWidgets function does just what you need here and it’s a method that sometimes gets overlooked. The basic idea is that you’ll setup your widgets as usual, just not in the scene’s setup method, then use the scene’s controller to call the instantiateChildWidgets function on the container div of the widgets you’re setting up.
Here’s a more detailed & totally contrived example (my specialty) where we’ll instantiate a list of list selectors, but not until after the setup method of our scene is called. All the code is included in the attached sample app here.
Step 1 – Generate an application. Mine is titled DynamicWidgets.
Step 2 – Generate a scene. I named mine ‘main’.
Step 3 – Add the following HTML to your new scene:
   
The choiceList element is just a standard Mojo list. However notice it’s contained in a div named “container”. We’ll use this later when we call instantiateChildWidgets which instantiates any widgets in the container div passed to it.
Step 4 – Add a new HTML file in your scene’s view directory. Mine is named list-item.html. In that file add the following HMTL:
   
      
   
This is standard HTML for a list item, and you can see that each item contains a ListSelector widget. Still nothing new here.
Step 5 – In your scene assistant, add the following code (change the assistant name to match what you’ve called yours):
function MainAssistant(){};

MainAssistant.prototype = {

    selectorChoices: [
        {label:'Choice 1', value:"choice1"},
        {label:'Choice 2', value:"choice2"},
        {label:'Choice 3', value:"choice3"},
        {label:'Choice 4', value:"choice4"},
        {label:'Choice 5', value:"choice5"}
    ],

    choiceListModel: {
        items: [
            {choice:'choice1'},
            {choice:'choice2'},
            {choice:'choice3'},
            {choice:'choice4'}
        ]},

    setup: function() {
        setTimeout(this.loadList.bind(this), 5000);

    },

    loadList: function() {
        this.controller.setupWidget('choiceList',
            {
                itemTemplate:'main/list-item'
            },
            this.choiceListModel
        );

        this.controller.setupWidget('choiceSelector',
            {
                label: 'Choice',
                modelProperty: 'choice',
                choices: this.selectorChoices
            }
        );

        this.controller.instantiateChildWidgets($('container'));

    }
};
Here we set up our list selector options and model as members of the scene assistant, but you can do this however you’d like as long as they’re defined prior to setting up the related widgets. The more interesting piece is that in our assistant’s setup function, rather than setting up our widgets we specify another function to be called after 5 seconds. In that function, loadList, we set up our list and selector widgets. Finally we call the star of this post, the instantiateChildWidgets function, which will instantiate our widgets contained in the div we pass to it.
Step 6 – Before we can run this example, don’t forget to add the following to stage-assistant.js:
this.controller.pushScene('main');
Now after packaging, installing, running, and waiting 5 seconds (for the timeout we added) here’s what you should see:

It’s not incredibly exciting I suppose, but in the attached sample as an extra special bonus I’ve included a dynamically instantiated button in each list item plus a tap handler!
I hope this sheds a bit of light on an API that is relatively obscure. In the right situation, though, it may be just what you need, and not at all difficult to take advantage of. Also note that there is an example in our mojomatters sample app (included in our SDK) which demonstrates a lazy list with dynamically instantiated drawer widgets added dynamically to the scene with a string of HTML and a call to instantiateChildWidgets. You’ll find it in the lazylistlazywidgets-assistant.js code.

  

LG OLED evo M5, the Only True Wireless OLED TV With G5’s Excellence in Picture Quality.

  With Uncompromised, Low-Lag Performance at 4K 144Hz, LG’s Advanced Wireless Technology Sets a New Standard for Clutter-Free Gaming and Hom...

Popular Posts