B4A ကို Setup လုပ္ျပီးရင္ေတာ့ First program ေလးတစ္ခုေရးၾကည့္ပါမယ္။
B4A ကုိဖြင့္လိုက္ပါ။ B4A ကုိဖြင့္လုိက္ျပီဆုိတာနဲ႕ Module တစ္ခုအနည္းဆံုးပြင့္ေနပါမယ္။
ေအာက္က Code ေတြနဲ႕ Module တစ္ခုေပါ့။ Main Module လုိ႕သတ္မွတ္ပါ။
--------------------------------------------------------------------------------------------------------------
#Region Project Attributes
#ApplicationLabel: B4A Example ( ဒါကေတာ့ ေဆာ့ဝဲနာမည္ပါ )
#VersionCode: 1
#VersionName: ( ဒီေနရာမွာ Version ထည့္ႏိူင္ပါတယ္ ဥပမာ 1.0.0 )
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified ( ဒါကေတာ့ Screen Rotation အတုိင္းေဆာ့ဝဲအသံုးျပဳမႈ )
#CanInstallToExternalStorage: False ( Sd card ကုိ Install လုပ္မလုပ္ သတ္မွတ္ေပးမွာပါ )
#End Region
#Region Activity Attributes
#FullScreen: False ( Noti Bar မေပၚခ်င္ပဲ အျပည့္ေပၚခ်င္ရင္ True လုပ္ေပးပါ )
#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.
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")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
----------------------------------------------------------------------------------------------------------
ဖြင့္ျပီးသြားတာနဲ႕ Project ကုိ Save လုိက္ပါ။ Desktop ေပၚမွာ B4A လုိ႕ Folder ေဆာက္ပါ။
ျပီးရင္ B4A Folder ထဲမွာမွ Hello World လုိ႕ Folder ေဆာက္ျပီး Project ကုိ သိမ္းပါ။
Project တစ္ခုကုိ Folder တစ္ခုထားသင့္ပါတယ္။
ျပီးရင္ေတာ့ ဖုန္းကုိ USB ၾကိဳးနဲ႕ခ်ိတ္ျပီး F5 နဲ႕ run ၾကည့္လုိက္ပါ။
ဘာမွေပၚမွာမဟုတ္ပါဘူး ။ Blank Project ပါ။
Code နည္းနည္းျဖည့္ၾကည့္ပါမယ္။
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
ရဲ႕ေအာက္မွာ ေအာက္က Code ေလးေရးပါမယ္။
Msgbox("Hello World","Hi")
ျပီးရင္ F5 ကုိႏွိပ္ျပီး Run ၾကည့္လုိက္ပါ။ Phone မွာ Hello World ဆုိတဲ့ Msgbox ေလးတတ္လာပါမယ္။
No comments:
Post a Comment