HELP PLEASE! - Simple login screen

I’m trying to get a simple logon screen to work, but the native interface on Android does not seem to work. Also, for such a small program, the “.apk” file generated is HUGE - 1.8MB! What can I do to fix these issues?

Thanks for your help.

CODE:

– Abstract: Program to check how native text fields behave

– Show a text field on the screen. Specify a font for the field.
– Create an event handler which will move the field when the
– user starts entering text into the field.
– When user has entered text, print a message on the screen

– Create a black background behind the slides
local bgimage = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bgimage:setFillColor( 0,0,100)

usernameText = display.newText(“Name”, 50, 200, native.systemFont, 24)
usernameText:setTextColor(255, 255, 255)

passwordText = display.newText(“Pass”, 50, 250, native.systemFont, 24)
passwordText: setTextColor(255, 255, 255)

local function doName( event )
if ( “began” == event.phase ) then
– Move field right, just to see that it works
usernameField.x = 75
passwordField.x = 75
elseif ( “submitted” == event.phase ) then
– Automatically tab to password field if user clicks “Return” on iPhone keyboard (convenient!)
native.setKeyboardFocus( passwordField )
end
end

local function doPass( event )
– Hide keyboard when the user clicks “Return” in this field
if ( “submitted” == event.phase ) then
native.setKeyboardFocus( nil )
usernameText.text = "Welcome ", usernameField.text
passwordText.text = "Your password is: ", passwordField.text
end
end

local usernameField = native.newTextField( 50, 100, 220, 60, doName )
usernameField.font = native.newFont( native.systemFontBold, 16 )
usernameField.text = “”
usernameField.align = “left”
usernameField:setTextColor( 51, 51, 122, 255 )

local passwordField = native.newTextField( 50, 150, 220, 60, doPass )
passwordField.font = native.newFont( native.systemFontBold, 16 )
passwordField.text = “”
passwordField.align = “left”
passwordField.isSecure = true
passwordField:setTextColor( 51, 51, 122, 255 )
[import]uid: 8484 topic_id: 5716 reply_id: 305716[/import]

Is there anyone who can help? There must be some simple mistake which I’m making,
but I just cannot find it :frowning:

Also, why is the executable so large - 1.8MB? There is nothing in the directory
but the main.lua file and theDebug key to get the app onto the phone. Both files
together are 8KB.

Thanks for your attention.

KP [import]uid: 8484 topic_id: 5716 reply_id: 19865[/import]