HI, All
I remember that seen somewhre, but cannot find.
If each activity has the same ACtoobar with a menu - the best way to make a class for this code batch.
The view is loaded from separated Layout files.
But full toolbar control must be saved.
How ?
Trying to make the class named "toolbar":
And error during compilation:
I remember that seen somewhre, but cannot find.
If each activity has the same ACtoobar with a menu - the best way to make a class for this code batch.
The view is loaded from separated Layout files.
But full toolbar control must be saved.
How ?
Trying to make the class named "toolbar":
B4X:
Sub Class_Globals
Private Act As Activity
Dim ACToolBarLight1 As ACToolBarLight
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(Activity As Activity, Title As String, SubTitle As String)
Act = Activity
For Each v As View In Act.GetAllViewsRecursive
If v Is ACToolBarLight Then
ACToolBarLight1 = v
Exit
End If
Next
If Title = "" Then
ACToolBarLight1.Title = Application.LabelName
Else
ACToolBarLight1.Title = Title
End If
ACToolBarLight1.SubTitle = SubTitle
ACToolBarLight1.InitMenuListener
End Sub
Sub Activity_CreateMenu(Menu As ACMenu)
Menu.Clear
' ACToolBarLight1.Menu.Add2(0, 0, "RU -> EN", Null)
End Sub
Sub ACToolBarLight1_MenuItemClick (Item As ACMenuItem)
Log("Clicked: " & Item.Title)
If Item.Id = 0 Then 'back
else If Item.Id = 1 Then 'settings
'StartActivity(Prefs1)
else If Item.Id = 2 Then 'exit
'Exit_Click
End If
End Sub
#If Java
public boolean _onCreateOptionsMenu (android.view.Menu menu)
{ try { _activity_createmenu (new de.amberhome.objects.appcompat.ACMenuWrapper (menu)); return true; }
catch (Exception e) { return false; } }
#End If
B4X:
B4A line: 4
End Sub
javac 1.8.0_151
src\peacemaker\upravdom\toolbar.java:156: error: method _activity_createmenu in class toolbar cannot be applied to given types;
{ try { _activity_createmenu (new de.amberhome.objects.appcompat.ACMenuWrapper (menu)); return true; }
^
required: toolbar,ACMenuWrapper
found: ACMenuWrapper
reason: actual and formal argument lists differ in length
Last edited: