Italian Problemi di compilazione

ken87

Active Member
Licensed User
Buinasera,
Compilando questo progetto:

B4X:
#Region  Project Attributes
   #ApplicationLabel: AppCompat1
   #VersionCode: 2
   #VersionName: 2.0
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#Extends: android.support.v7.app.AppCompatActivity


#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 Spinner1 As Spinner
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("b4a4lay1")
 
   Spinner1.AddAll(Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))
 
   'Set some ActionBar options
   Dim bar As ACActionBar
   bar.Initialize
   bar.Title = "Simple AppCompat example"
   bar.Subtitle = "This is a Subtitle"
 
   Activity.AddMenuItem("Test overflow", "Menu")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub EditText1_TextChanged (Old As String, New As String)
   Log("EditText1 TextChanged event fired")
End Sub

Sub EditText1_EnterPressed
   Log("EditText1 EnterPressed event fired")
End Sub

Sub EditText1_FocusChanged (HasFocus As Boolean)
   Log("EditText1 FocusChanged event fired")
End Sub

Sub CheckBox1_CheckedChange(Checked As Boolean)
   Log("CheckBox1 CheckedChange event fired")
End Sub

Sub RadioButton1_CheckedChange(Checked As Boolean)
   Log("RadioButton1_CheckedChange event fired")
End Sub

Sub Spinner1_ItemClick (Position As Int, Value As Object)
   Log("Spinner1 ItemClick event fired")
End Sub

Sub Button1_Click
   Log("Button1 Click event fired")
End Sub

Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
   Log("Seekbar1 ValueChanged event fired")
End Sub

Ricevo il seguente errore:

B4A Versione: 7.30
Analisi del Codice. (0.00s)
Compilazione del codice. (0.05s)
Compilazione del codice di layouts (0.00s)
Organizzazione Librerie. (0.00s)
Generazione file R. (0.55s)
Compilazione del codice Java prodotto. Error
javac 1.8.0_144
src\de\amberhome\appcompat\example1\main.java:331: error: package de.amberhome.objects.appcompat does not exist
de.amberhome.objects.appcompat.ACActionBar _bar = null;
^
1 error
Sapete il motivo?
Grazie mille
 
Last edited:

MarcoRome

Expert
Licensed User
1. Quando inserisci del codice utilizza i tag:
upload_2017-9-12_18-37-52.png

2. Commenta: #AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
 

ken87

Active Member
Licensed User
Se commento la riga di codice

B4X:
#AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
Mi da errore subito perchè non trova la libreria android.support.v7.appcompat.

ecco
B4A Versione: 7.30
Analisi del Codice. (0.00s)
Compilazione del codice. (0.04s)
Compilazione del codice di layouts (0.00s)
Organizzazione Librerie. (0.00s)
Generazione file R. Error
C:\android\sdk1\platforms\android-21\progetti2\AppCompatExample1\Objects\bin\extra\res2\res\values-v23\values-v23.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
C:\android\sdk1\platforms\android-21\progetti2\AppCompatExample1\Objects\bin\extra\res2\res\values-v23\values-v23.xml:34: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
C:\android\sdk1\platforms\android-21\progetti2\AppCompatExample1\Objects\bin\extra\res2\res\values-v24\values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
C:\android\sdk1\platforms\android-21\progetti2\AppCompatExample1\Objects\bin\extra\res2\res\values-v24\values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

Ok la prossina volta faccio così
 

Attachments

ken87

Active Member
Licensed User
Sono riuscito a far girare questo codice con app compact 2.0 :

B4X:
#Region  Project Attributes
    #ApplicationLabel: AppCompat1
    #VersionCode: 2
    #VersionName: 2.0
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

'#AdditionalRes: ..\resource

'#AdditionalRes:  ..\b4a_appcompat, de.amberhome.objects.appcompat
#AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
'#AdditionalRes: $AndroidSDK$\extras\android\support\design\res, android.support.design
  '  #AdditionalRes: $AndroidSDK$\extras\android\support\v7\recyclerview\res, android.support.v7.recyclerview


#Extends: android.support.v7.app.AppCompatActivity


#Region  Activity Attributes
    #FullScreen: 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.

    Private Spinner1 As Spinner
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("b4a4lay1")

    Spinner1.AddAll(Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))

    'Set some ActionBar options
    'Dim bar As ACActionBar
    'bar.Initialize
    'bar.Title = "Simple AppCompat example"
    'bar.Subtitle = "This is a Subtitle"

    'Activity.AddMenuItem("Test overflow", "Menu")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub EditText1_TextChanged (Old As String, New As String)
    Log("EditText1 TextChanged event fired")
End Sub

Sub EditText1_EnterPressed
    Log("EditText1 EnterPressed event fired")
End Sub

Sub EditText1_FocusChanged (HasFocus As Boolean)
    Log("EditText1 FocusChanged event fired")
End Sub

Sub CheckBox1_CheckedChange(Checked As Boolean)
    Log("CheckBox1 CheckedChange event fired")
End Sub

Sub RadioButton1_CheckedChange(Checked As Boolean)
    Log("RadioButton1_CheckedChange event fired")
End Sub

Sub Spinner1_ItemClick (Position As Int, Value As Object)
    Log("Spinner1 ItemClick event fired")
End Sub

Sub Button1_Click
    Log("Button1 Click event fired")
End Sub

Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
    Log("Seekbar1 ValueChanged event fired")
End Sub
Però se tolgo il commento a queste istruzioni:

B4X:
Dim bar As ACActionBar
    bar.Initialize
    bar.Title = "Simple AppCompat example"
    bar.Subtitle = "This is a Subtitle"
 
    Activity.AddMenuItem("Test overflow", "Menu")
Da questo errore:

B4A Versione: 7.30
Analisi del Codice. (0.00s)
Compilazione del codice. (0.04s)
Compilazione del codice di layouts (0.00s)
Organizzazione Librerie. (0.00s)
Generazione file R. (0.60s)
Compilazione del codice Java prodotto. Error
javac 1.8.0_144
src\de\amberhome\appcompat\example1\main.java:331: error: package de.amberhome.objects.appcompat does not exist
de.amberhome.objects.appcompat.ACActionBar _bar = null;
 

ken87

Active Member
Licensed User
Copia il contenuto contenuto nel file zip resource stello livello cartella "Files", "Object"
View attachment 59610
Ho provato ma non fuziona .. sto pensando che manchi qualcosa nel pc .

Ho installato tutto bene?
Includo le installazioni sdk, e le foto dove c'e installato B4A..

Tra alro riesco a far girare una parte del codice usando la libreria Appcmpat 2.0 se l'aggiorno va tutto in errore.
Fodametemente a me serviva una barra menu con icone..
Grazie mille dell'aiuto
 

Attachments

Last edited:

udg

Expert
Licensed User
Fodametemente a me serviva una barra menu con icone..
Prova a dare un'occhiata alla mia vecchia libreria dgActionBar. Segue il ragionamento di @LordZenzo , un panel che contiene tre elementi opzionali : un logo, una serie di icone ed un menu).

udg
 

ken87

Active Member
Licensed User
Grazie a tutti per l'aiuto..

Ho provato esempio 2 della dgActionBar suggerita
Posto il codice compliato
B4X:
#Region  Project Attributes
    #ApplicationLabel: dgActionBar Example 2
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #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 pnlLeft,pnlRight As Panel
    Dim p As Phone                       'used to reach internal bitmaps
        Dim mIcons(4) As Bitmap              'can be any size. Here I set it to 4 elements
    Dim ActionBarL As cl_dgactbar
        Dim ActionBarR As cl_dgactbar
End Sub


Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
  Activity.Title="dgActionBar Test 2"
    'let's divide the activity area in two equal sized panels
    pnlLeft.Initialize("")
    Activity.AddView(pnlLeft,0%x,0%y,50%x,100%y)
    pnlLeft.Color=Colors.Green
    pnlRight.Initialize("")
    Activity.AddView(pnlRight,50%x,0%y,50%x,100%y)
    pnlRight.Color=Colors.Red

    'The images can be taken from resources or you can load your own
    'to fill the 4 item array I use 4 resources
    Dim bd As BitmapDrawable
  bd = p.GetResourceDrawable(17301581)
    mIcons(0).Initialize3(bd.Bitmap)
    bd = p.GetResourceDrawable(17301586)
  mIcons(1).Initialize3(bd.Bitmap)
    bd = p.GetResourceDrawable(17301582)
  mIcons(2).Initialize3(bd.Bitmap)
    bd = p.GetResourceDrawable(17301577)
  mIcons(3).Initialize3(bd.Bitmap)

  'Initialize the ActionBar for Left panel
   ActionBarL.Initialize(pnlLeft, Me, "ManagerL")
     'Optional: configure the ActionBar appearance.
     'here we ask for an horizontal bar, fill owner panel to the edge, gradient background, no image background
      ActionBarL.setAppearance(ActionBarL.bar_horizontal,ActionBarL.bar_Fill,Colors.ARGB(255, 20, 20, 20),Colors.ARGB(255, 160, 160, 160),Null)
     'Optional: each of the three following settings (logo, icons and menu) is optional, but an empty ActionBar is a nonsense
     'here we prepare the elements we want to appear on the actionbar: a logo panel, an icons panel and a menu button
     ActionBarL.Logo = LoadBitmap(File.DirAssets,"actionbarlogo.png")
     ActionBarL.setBitmapArray(mIcons,20) '20 is the span, in dip units, between adjacent icons
     ActionBarL.MenuLogo = LoadBitmap(File.DirAssets,"actionbarmenubutton.png")
   'Prepare the menu panel. Needed only if a menu button is showed on the actionbar
   ActionBarL.SetMenu(ActionBarL.bar_MenuBottom, 200dip, 200dip, Null, Colors.DarkGray, Colors.White)
     'fill menu with 10 items
   For I = 1 To 10
     ActionBarL.AddMenuItem(LoadBitmap(File.DirAssets, "ActionBarLogo.png"), "Item " & I,  I)
   Next
     'Show the ActionBar, superimposing it on its owner panel (see Initialize method)
     'here we ask for a static ActionBar, showing all three elements above and positioned in the top left corner of its owner panel
     'when the user clicks on any of the elements on the AB, the ManagerL_Done event is fired but the AB stays visible
     ActionBarL.ShowActionBar(0, 0, ActionBarL.bar_Static, True, True, True)

  'Initialize the ActionBar for the Right panel
   ActionBarR.Initialize(pnlRight, Me, "ManagerR")
     'Optional: configure the ActionBar appearance.
     'here we ask for a vertical bar, bar height automatically computed, nice image background
      ActionBarR.setAppearance(ActionBarR.bar_vertical,ActionBarR.bar_NoFill,Colors.ARGB(255, 20, 20, 20),Colors.ARGB(255, 160, 160, 160), _
     LoadBitmap(File.DirAssets,"bkggreen.png"))
     'Optional: each of the three following settings (logo, icons and menu) is optional, but an empty ActionBar is a nonsense
     'here we prepare the elements we want to appear on the actionbar: a logo panel, an icons panel and a menu button
     ActionBarR.Logo = LoadBitmap(File.DirAssets,"actionbarlogo.png")
     ActionBarR.setBitmapArray(mIcons,30) '30 is the span, in dip units, between adjacent icons
     ActionBarR.MenuLogo = LoadBitmap(File.DirAssets,"actionbarmenubutton.png")
   'Prepare the menu panel. Needed only if a menu button is showed on the actionbar
   ActionBarR.SetMenu(ActionBarR.bar_MenuLeft, 200dip, 200dip, Null, Colors.DarkGray, Colors.White)
     'fill menu with 10 items
   For I = 1 To 10
     ActionBarR.AddMenuItem(LoadBitmap(File.DirAssets, "ActionBarLogo.png"), "Item " & I,  I)
   Next
     'Show the ActionBar, superimposing it on its owner panel (see Initialize method)
     'here we ask for a static ActionBar, showing all three elements above and positioned in the top right corner of its owner panel
     'when the user clicks on any of the elements on the AB, the ManagerR_Done event is fired but the AB stays visible
     ActionBarR.ShowActionBar(pnlRight.Width-72dip, 0, ActionBarR.bar_Static, True, True, True)
End Sub


Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
  If UserClosed Then
      ActionBarL.Destroy  'hopefully this should free any resources, avoiding memory leaks
        ActionBarR.Destroy
    End If   
End Sub

Sub ManagerL_Done
  If ActionBarL.IsValueReady Then
      'Returned values:
        ' 0 = logo menu was clicked
        ' positive number, 1 to number of icons = corresponding icon was clicked
        ' negative number, -1 to -1*number of menu items = corresponding menu item was clicked (in absolute form)
        ToastMessageShow("ActionBar on left panel value = " & ActionBarL.ItemValue, False)
  End If
End Sub

Sub ManagerR_Done
  If ActionBarR.IsValueReady Then
      'Returned values:
        ' 0 = logo menu was clicked
        ' positive number, 1 to number of icons = corresponding icon was clicked
        ' negative number, -1 to -1*number of menu items = corresponding menu item was clicked (in absolute form)
        ToastMessageShow("ActionBar on right panel value = " & ActionBarR.ItemValue, False)
  End If
End Sub
Il programma complia ma poi mi da i seguenti errori:


** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 390)
java.lang.NoSuchMethodError: anywheresoftware.b4a.objects.ListViewWrapper.AddTwoLinesAndBitmap2
at eu.dgconsulting.dgactionbar.cl_dgactbar._addmenuitem(cl_dgactbar.java:79)
at eu.dgconsulting.dgabarex2.main._activity_create(main.java:390)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at eu.dgconsulting.dgabarex2.main.afterFirstLayout(main.java:102)
at eu.dgconsulting.dgabarex2.main.access$000(main.java:17)
at eu.dgconsulting.dgabarex2.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
main_activity_create (java line: 390)
java.lang.NoSuchMethodError: anywheresoftware.b4a.objects.ListViewWrapper.AddTwoLinesAndBitmap2
at eu.dgconsulting.dgactionbar.cl_dgactbar._addmenuitem(cl_dgactbar.java:79)
at eu.dgconsulting.dgabarex2.main._activity_create(main.java:390)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at eu.dgconsulting.dgabarex2.main.afterFirstLayout(main.java:102)
at eu.dgconsulting.dgabarex2.main.access$000(main.java:17)
at eu.dgconsulting.dgabarex2.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
Sapete il motivo?
 

ken87

Active Member
Licensed User
Io ho la versione b4a 7.30 . Puoi incudere un esempio semplice con loìibreria aggiornata?
Grazie mille
 

ken87

Active Member
Licensed User
Un esempio per fare un semplice menu funzionate stavo provando con Stdactionbar ma sembra che non sia compatibile con tutte le versioni.
Stavo cercando una semlpice barra con icona e menu nulla di più ..
Grazie mille
 

udg

Expert
Licensed User
quella libreria va ricompilata con la nuova versione di b4a
La versione 1.10 è stata compilata con B4A 7.30 e, a leggere il post #22 di quel thread, dovrei anche aver testato con gli esempi di codice proposti.
Che dire ? Proverò di nuovo..

Edit: provato e funziona. A questo punto l'avvertenza è semplicemente quella di utilizzare la versione 1.10 con B4A 7.30 (probabilmente ok a partire da B4A 7.01) mentre di rimanere sulla versione precedente per B4A < 7.01
 
Last edited:

ken87

Active Member
Licensed User
La versione 1.10 è stata compilata con B4A 7.30 e, a leggere il post #22 di quel thread, dovrei anche aver testato con gli esempi di codice proposti.
Che dire ? Proverò di nuovo..

Edit: provato e funziona. A questo punto l'avvertenza è semplicemente quella di utilizzare la versione 1.10 con B4A 7.30 (probabilmente ok a partire da B4A 7.01) mentre di rimanere sulla versione precedente per B4A < 7.01
La versione è 7.30
Puoi postare il pachetto funzinate...
 

Attachments

Top