In “day 3″ we will learn how to make our application communicate with a webserver. There are 2 ways we can do this: one is to use a webview and point it to a real web page or using the HttpClient that Appcelerator provides us.
What is WebView? A WebView is nothing more than a chromeless browser or, if you want, a “naked” browser (it misses the interface we’re used to) that allows us to open remote or local webpages and display it in our apps.
You can use the webview for many purposes starting from displaying some nice html/css formatted text to building your own in-app browser. One thing you must NOT forget is that the webview it’s very expensive for the device (in terms of CPU load and memory usage) so try to use it only when it’s really really needed.
The webview is created using the function Titanium.UI.createWebView. Some things to specify about it would be that you have to choose between managing the touch events as a Titanium entity, or let the webpage do this. You cannot have both in the same time.
Two events that deserve more attention are beforeLoad and load that can be used to show and hide a “loading…” screen from the moment you try to load a remote page until the webpage is fully loaded.