Sie sind auf Seite 1von 4

Taller android Fredy Orozco Presentacion Explicacin de el entorno Creacin de avd Ejercicios Hola mundo label Hola usuario

con edit text y buton Suma de dos nmeros Suma Resta multiplicacin divisin pitagoras nuevo activity modificar propiedades label navegador

Activity 1
#Region Project Attributes #ApplicationLabel: Ejercicio calculadora #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: portrait #CanInstallToExternalStorage: False #End Region #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim btnmas,btnmenos,btnpor,btndividido,btnteorema,btnnext As Button Dim display,display2 As EditText End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") #Region botones btnmas.Initialize("btnmas") btnpor.Initialize("btnpor") btnmenos.Initialize("btnmenos") btndividido.Initialize("btndividido") btnteorema.Initialize("btnteorema") btnnext.Initialize("btnnext") display.Initialize("display") display2.Initialize("display2") #End Region #Region interfaz Activity.AddView(display,0%x,0%y,100%x,60dip) Activity.AddView(display2,0%x,15%y,100%x,60dip) Activity.AddView(btnmas,0%x,35%y,60dip,60dip) Activity.AddView(btnmenos,73dip,35%y,60dip,60dip) Activity.AddView(btnpor,143dip,35%y,60dip,60dip) Activity.AddView(btndividido,203dip,35%y,60dip,60dip) Activity.AddView(btnteorema,263dip,35%y,60dip,60dip) Activity.AddView(btnnext,0,65%y,60dip,60dip) btnmas.Text="+" btnmenos.Text="-"

btnpor.Text="X" btndividido.Text="/" display.Hint="0" display2.Hint="0" #End Region End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub btnmas_Click Dim resultado As Double resultado=display.Text+display2.Text Msgbox("EL resultado es: "& resultado ,"") End Sub Sub btnmenos_click Dim resultado As Double resultado=display.Text-display2.Text Msgbox("EL resultado es: "& resultado ,"") End Sub Sub btnpor_Click Dim resultado As Double resultado=display.Text*display2.Text Msgbox("EL resultado es: "& resultado ,"") End Sub Sub btndividido_click Dim resultado As Double resultado=display.Text/display2.Text Msgbox("EL resultado es: "& resultado ,"") End Sub Sub btnteorema_click Dim x,y,z As Double x=display.Text y=display2.Text z=Sqrt (Power(x,2)+Power(y,2)) Msgbox("la hipotenusa es: "&z,"Teorema de pitagoras") End Sub Sub btnnext_click StartActivity(activity2) End Sub

Activity 2
#Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim leyenda As Label Dim navega As WebView Dim url As EditText Dim btnir As Button End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") leyenda.Initialize("end leyenda") leyenda.Text="Activity numero 2" leyenda.TextColor=Colors.Green leyenda.TextSize=14 leyenda.Gravity=Gravity.CENTER_HORIZONTAL Activity.AddView(leyenda,0,70%y,60dip,60dip) url.Initialize("url") btnir.Initialize("btnir") navega.Initialize("navega") Activity.AddView(url,0,0,80%x,10%y) Activity.AddView(btnir,81%x,0,10%x,10%y) Activity.AddView(navega,0,15%y,100%x,48%y) End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub btnir_click navega.LoadUrl("http://"&url.Text) End Sub