[Resolved] Need help with this code - nothing showing

Hi,

I have looked up the webview in the docs for displaying a website inside my app. I took their example code and put it in a new project. When I run this on my phone (Samsung Galaxy S2) I get a solid white screen. Am I missing something? Shouldn’t it at add the webview at the position 0,0,320,480 and show the site automatically? Or do I need to call something else?

Thanks!!

[code]


– main.lua


– Your code here

local function webListener( event )
if event.url then
print( "You are visiting: " … event.url )
end

if event.type then
print( "The event.type is " … event.type ) – print the type of request
end

if event.errorCode then
native.showAlert( “Error!”, event.errorMessage, { “OK” } )
end
end

local webView = native.newWebView( 0, 0, 320, 480, webListener )
webView:request( “http://www.coronalabs.com/” )

webView:addEventListener( “urlRequest”, webListener )
[/code] [import]uid: 184193 topic_id: 32319 reply_id: 332319[/import]

Nevermind it worked! I guess I didn’t have a good data connection when I first tried it.

Thanks
[import]uid: 184193 topic_id: 32319 reply_id: 128627[/import]

Thanks for updating this, glad you got it sorted out - marking as resolved.

Peach :slight_smile: [import]uid: 52491 topic_id: 32319 reply_id: 128695[/import]

Nevermind it worked! I guess I didn’t have a good data connection when I first tried it.

Thanks
[import]uid: 184193 topic_id: 32319 reply_id: 128627[/import]

Thanks for updating this, glad you got it sorted out - marking as resolved.

Peach :slight_smile: [import]uid: 52491 topic_id: 32319 reply_id: 128695[/import]