D
It doesn't matter which android.jar you use during compilation. It is most probably a bug in your code.I've compiled the app with "android.jar 25", maybe the bug is in this version?
The new error message is better than in the previous version as now you can see where it fails. Previously it just showed something about CallSub.Because the routine "initspeedpilot" and "mbbl._vvvvvvvvvvvvvvvvvvvvv6" have not changed.
This is my code:Where is the code that initializes the canvas?
Sub Activity_Create(FirstTime As Boolean)
...
'Speedpilot initiallisieren
CallSubDelayed(Me, "InitSpeedpilot")
...
End Sub
'The label "lblSettingSpeed" is initialized in the designer.
Private Sub InitSpeedpilot
mBBL.SetTextSize(lblSettingSpeed, "000.00", 1, True)
End Sub
'Modul mBBL
'Der Parameter "Scale" bei Buttons nicht verwendet!
Sub SetTextSize(obj As View, txt As String, scale As Float, singleline As Boolean)
Dim cv As Canvas
'Log("SetTextSize: txt=" & txt & " :obj=" & obj)
setSingleLine(obj, singleline)
If obj Is Button Then
Dim btn As Button = obj
cv.Initialize(btn)
SetButtonTextSize(btn, txt, cv)
Else
Dim lbl As Label = obj
cv.Initialize(lbl)
SetLabelTextSize(lbl, txt, scale, cv)
End If
End Sub
'Sets the TextView to single line
Public Sub setSingleLine(TextView As View, SingleLine As Boolean)
Dim jo = TextView As JavaObject
jo.RunMethod("setSingleLine", Array As Object(SingleLine))
End Sub
Private Sub SetButtonTextSize(btn As Button, txt As String, cv As Canvas)
Dim stu As StringUtils
Dim dt As Float
Dim h, Height As Int
Dim w, Width As Int
Height = btn.Height - 14dip
Width = btn.Width
btn.Text = txt
btn.TextSize = 6
dt = btn.TextSize
h = stu.MeasureMultilineTextHeight(btn, txt)
w = MeasureStringWidth(btn, dt, cv)
Do While h <= Height
dt = dt + 2
btn.TextSize = dt
h = stu.MeasureMultilineTextHeight(btn, txt)
w = MeasureStringWidth(btn, dt, cv)
If w >= (Width - 10dip) Or h > Height Then
btn.TextSize = dt - 2
Exit
End If
Loop
End Sub
Private Sub SetLabelTextSize(lbl As Label, txt As String, scale As Float, cv As Canvas)
Dim stu As StringUtils
Dim dt As Float
Dim h, Height As Int
Dim w, Width As Int
Height = lbl.Height * scale
Width = lbl.Width
'WICHTIG! Die Width darf nicht weniger als null sein!
If lbl.Width < 0 Then Return
lbl.Text = txt
lbl.TextSize = 6
dt = lbl.TextSize
h = stu.MeasureMultilineTextHeight(lbl, txt)
w = MeasureStringWidth(lbl, dt, cv)
Do While h <= Height
dt = dt + 2
lbl.TextSize = dt
h = stu.MeasureMultilineTextHeight(lbl, txt)
w = MeasureStringWidth(lbl, dt, cv)
If w >= (Width - 10dip) Or h > Height Then
lbl.TextSize = dt - 2
Exit
End If
Loop
End Sub
Private Sub MeasureStringWidth(obj As View, TextSize As Float, cv As Canvas) As Float
If obj Is Button Then
Dim btn As Button = obj
Return cv.MeasureStringWidth(btn.Text, btn.Typeface, TextSize)
Else
Dim lbl As Label = obj
Return cv.MeasureStringWidth(lbl.Text, lbl.Typeface, TextSize)
End If
End Sub
Then you know the people who use my app?CronoMilleMiglia? Millemiglia passes every spring end in front of my house... The strange is that it seems that other phones have already downloaded the new version and no issue was signaled. Are you trying to download an image from the network?
No, it has nothing to do with it.Are you trying to download an image from the network?
To measure the string width.What is the purpose of this canvas?
With security-not, at least not consciously.Have you set the width of the label to -1?
Sub Class_Globals
Private bmp As Bitmap
Private cvs As Canvas
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
bmp.InitializeMutable(1dip, 1dip)
cvs.Initialize2(bmp)
End Sub
#Region TextSize vom Label, EditText und Button ändern
'Der Parameter "Scale" bei Buttons nicht verwendet!
Public Sub SetTextSize(obj As View, txt As String, scale As Float, singleline As Boolean)
'Log("SetTextSize: txt=" & txt & " :obj=" & obj)
setSingleLine(obj, singleline)
If obj Is Button Then
Dim btn As Button = obj
SetButtonTextSize(btn, txt)
Else
Dim lbl As Label = obj
SetLabelTextSize(lbl, txt, scale)
End If
End Sub
'Sets the TextView to single line
Public Sub setSingleLine(TextView As View, SingleLine As Boolean)
Dim jo = TextView As JavaObject
jo.RunMethod("setSingleLine", Array As Object(SingleLine))
End Sub
Private Sub SetButtonTextSize(btn As Button, txt As String)
Dim stu As StringUtils
Dim dt As Float
Dim h, Height As Int
Dim w, Width As Int
Height = btn.Height - 14dip
Width = btn.Width
btn.Text = txt
btn.TextSize = 6
dt = btn.TextSize
h = stu.MeasureMultilineTextHeight(btn, txt)
w = MeasureStringWidth(btn, dt)
Do While h <= Height
dt = dt + 2
btn.TextSize = dt
h = stu.MeasureMultilineTextHeight(btn, txt)
w = MeasureStringWidth(btn, dt)
If w >= (Width - 10dip) Or h > Height Then
btn.TextSize = dt - 2
Exit
End If
Loop
End Sub
Private Sub SetLabelTextSize(lbl As Label, txt As String, scale As Float)
Dim stu As StringUtils
Dim dt As Float
Dim h, Height As Int
Dim w, Width As Int
Height = lbl.Height * scale
Width = lbl.Width
'WICHTIG! Die Width darf nicht weniger als null sein!
If lbl.Width < 0 Then Return
lbl.Text = txt
lbl.TextSize = 6
dt = lbl.TextSize
h = stu.MeasureMultilineTextHeight(lbl, txt)
w = MeasureStringWidth(lbl, dt)
Do While h <= Height
dt = dt + 2
lbl.TextSize = dt
h = stu.MeasureMultilineTextHeight(lbl, txt)
w = MeasureStringWidth(lbl, dt)
If w >= (Width - 10dip) Or h > Height Then
lbl.TextSize = dt - 2
Exit
End If
Loop
End Sub
Private Sub MeasureStringWidth(obj As View, TextSize As Float) As Float
If obj Is Button Then
Dim btn As Button = obj
Return cvs.MeasureStringWidth(btn.Text, btn.Typeface, TextSize)
Else
Dim lbl As Label = obj
Return cvs.MeasureStringWidth(lbl.Text, lbl.Typeface, TextSize)
End If
End Sub
#End Region
'WICHTIG! Die Width darf nicht weniger als null sein!
If lbl.Width < 0 Then Return
Sub Class_Globals
Private bmp As Bitmap
Private cvs As Canvas
Private stu As StringUtils
Private dt As Float
Private h, Height As Int
Private w, Width As Int
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
bmp.InitializeMutable(1dip, 1dip)
cvs.Initialize2(bmp)
End Sub
#Region TextSize vom Label, EditText und Button ändern
'Der Parameter "Scale" bei Buttons nicht verwendet!
Public Sub SetTextSize(obj As View, txt As String, scale As Float, singleline As Boolean)
'Log("SetTextSize: txt=" & txt & " :obj=" & obj)
setSingleLine(obj, singleline)
If obj Is Button Then
Dim btn As Button = obj
Height = btn.Height - 14dip
Width = btn.Width
SetButtonTextSize(btn, txt)
Else
Dim lbl As Label = obj
Height = lbl.Height * scale
Width = lbl.Width
SetLabelTextSize(lbl, txt, scale)
End If
End Sub
'Sets the TextView to single line
Public Sub setSingleLine(TextView As View, SingleLine As Boolean)
Dim jo = TextView As JavaObject
jo.RunMethod("setSingleLine", Array As Object(SingleLine))
End Sub
Private Sub SetButtonTextSize(btn As Button, txt As String)
btn.Text = txt
btn.TextSize = 6
dt = btn.TextSize
h = stu.MeasureMultilineTextHeight(btn, txt)
w = cvs.MeasureStringWidth(btn.Text, btn.Typeface, dt)
Do While h <= Height
dt = dt + 2
btn.TextSize = dt
h = stu.MeasureMultilineTextHeight(btn, txt)
w = cvs.MeasureStringWidth(btn.Text, btn.Typeface, dt)
If w >= (Width - 10dip) Or h > Height Then
btn.TextSize = dt - 2
Exit
End If
Loop
End Sub
Private Sub SetLabelTextSize(lbl As Label, txt As String, scale As Float)
lbl.Text = txt
lbl.TextSize = 6
dt = lbl.TextSize
h = stu.MeasureMultilineTextHeight(lbl, txt)
w = cvs.MeasureStringWidth(lbl.Text, lbl.Typeface, dt)
Do While h <= Height
dt = dt + 2
lbl.TextSize = dt
h = stu.MeasureMultilineTextHeight(lbl, txt)
w = cvs.MeasureStringWidth(lbl.Text, lbl.Typeface, dt)
If w >= (Width - 10dip) Or h > Height Then
lbl.TextSize = dt - 2
Exit
End If
Loop
End Sub
#End Region
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?