Hello,
I|m a beginner in Android application and need to add some features to the source code to show some extra measurements
I am going to add some parameters on the application.
My application measuring air pressure, temp. and .... now, I would like to add some other parameters too.
Is that enough to add lines under>
for example:
Private LabelPanelAcceleration As Label
Private LabelPanelAirHumidity As Label
Private LabelPanelAirPressure As Label
Private LabelPanelAirTemp As Label
Private LabelPanelBatteryLevel As Label
these are included in the source code
and some other codes in any other module and part of code, is it work only to add my lines under the defined parameters in source code?
Thanks for the reply.
Here i send some screen shots,
the original source code has 8 parameters which are shown on the screen, now I'm going to add some new parameters.
I've followed the same as originals, Is that correct? the code is compiled and run but it does not come on the screen properly. It comes for a second and disappeared,
I do appreciate if you could give me a clue, because I really need to deal with this for some short time and will g back to my domain. If I want to learn Java I have to start from A.
I do appreciate if anyone can help i this case.
thanks for the reply.
I'm a very beginner,
not really, I just followed the source code lines in every where in the code and added my parameters which I'm going to show them on the screen,
would you tell me how to do that?
Best regards.
There are two ways to add objects to your project.
1. Add them in the Designer, where you can change the properties directly and see the effects. These objects are initialised during loading of the layout file.
2. Add objects with code, where you must initialise the objects yourself (Dimension object + initialise object + set properties. In that order)
Please read the beginners guide as detailed in post#2. This will help you.
From your post in #5, you have dimensioned the object but not initialised it and then tried to change a property. That will not work.
Thanks you Mark.
would you please tell me where can I see the layout file for already source code objects which are available?
and where can I add this object initialization?
Best Regards.
The layout file is called something like layout.bal and is found in your project/files directory. You can open it by using the designer option in the IDE to start the designer and then Open. Or you create a new layout file.
This is all detailed in sections 2 (My first program) and 3 (Second program) of the B4A beginners guide (sections as in Version 3.2).
I repeat "Please read the beginners guide as detailed in post#2. This will help you.".
If you have further questions regarding errors and coding problems then just ask. The forum is not really for asking for a step by step guide to programming and using B4A.
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#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.
Private Button1 As Button
Private Button2 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("Layout") 'Layout.bal contains a single button called Button1
Button2.Initialize("Button2") 'This button is not in the layout file
Activity.AddView(Button2, 10dip,10dip,100dip,20dip) 'Add the button to the app screen
Button2.Text="Press me" 'Add text to the button
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'This is the event called when the button1 is clicked
End Sub
Sub Button2_Click
'This is the event called when the button2 is clicked
End Sub
Hello,
I have these two lines code:
it's a temperature converter, but I do not understand where these digits which have been highlighted come from?
May anyone help please.
Dim tempVal As Int
tempVal = Bit.ParseInt(data.SubString2(0,2), 16) * 256 + Bit.ParseInt(data.SubString2(2,4), 16)
tempVal = Bit.ParseInt(data.SubString2(0,4), 16)