User Tools

Site Tools


sample_code:sample_web_view

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sample_code:sample_web_view [2014/12/15 01:35]
170.178.251.101 created
sample_code:sample_web_view [2014/12/15 09:58] (current)
Line 1: Line 1:
-**Web View Example**+====== Web View Example ======
  
 +<file java webview.js>
 +//web view example
 +//Called when application is started. 
 +function OnStart() 
 +
 +    //Create a layout with objects vertically centered. 
 +    lay = app.CreateLayout( "linear", "VCenter,FillXY" );     
 +    //Create a web control. 
 +    web = app.CreateWebView( 1, 1,"AllowZoom,Wide,AutoZoom",50 ); 
  
 +    //setup loading... progress
 +    web.SetOnProgress( web_OnProgess ); 
 +
 +    //add web to layout
 +    lay.AddChild( web ); 
 +     
 +    //Create horizontal layout
 +    layHoriz = app.CreateLayout( "linear", "Horizontal" ); 
 +     
 +    //Add horizontal layout to main layout. 
 +    lay.AddChild( layHoriz ); 
 +     
 +    //Add layout to app.     
 +    app.AddLayout( lay ); 
 +
 +   //call load web page function
 +   loadWeb() 
 +
 +
 + 
 +//******functions******//
 +
 +
 +//Load web page
 +function loadWeb()
 +
 +  //show progress bar
 +  app.ShowProgressBar("Loading...",0);
 +  //load url
 +  web.LoadUrl("http://m.cat5.tv" ); 
 +
 +
 +//Show page load progress. 
 +function web_OnProgess( progress ) 
 +{   
 +  //update progress bar
 +  app.UpdateProgressBar(progress);
 +  //get progress update
 +  app.Debug( "progress = " + progress ); 
 +  //hide progress dialog when page loads
 +  if( progress==100 ) app.HideProgressBar(); 
 +
 +
 +//handle orienation change 
 +function OnConfig()
 +{
 +  //resize web view on orientation change
 +  web.SetSize(1,1);
 +}
 + 
 +
 +
 +
 +
 +</file>
sample_code/sample_web_view.1418607318.txt.gz · Last modified: 2014/12/15 09:35 (external edit)