Wednesday, 7 August 2013

How to create a native alert view using corona SDK



The below function defines the two alert button ('Learn More' & 'OK') actions:

local function onClick(e) 
    if e.action == "clicked" then 
        if e.index == 1 then 
            -- Do something
        elseif e.index == 2 then 
            system.openURL( "http://devblogdk.blogspot.in/" ) 
        end 
    end 
end 

The below code generates the native alertview with title, subject and two buttons:

local alert = native.showAlert("Welcome", "Development Tutorials on DevBlogDK", {"OK", "Learn More"}, onClick)

No comments:

Post a Comment