Android Question #Extends and B4A 10.70

Status
Not open for further replies.

MarcoRome

Expert
Licensed User
Longtime User
Hi @Erel, All
i have a project that has
B4X:
#Extends: android.support.v7.app.AppCompatActivity
and in the Manifest i i have.

B4X:
SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#222222</item>
        <item name="colorPrimaryDark">#222222</item>
        <item name="colorAccent">#009246</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
</resources>
)

Up to version 10.60 it compiled and ran correctly.
With 10.70 it is compiled but the set theme ( Theme.AppCompat.Light.NoActionBar ) is not executed

Why ?
Thank you
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
I tried this
and No, dont work. The message is:
B4A Version: 10.70 BETA #3
Parsing code. (0.00s)
Java Version: 14
Building folders structure. (0.01s)
Compiling code. (0.01s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.07s)
Linking resources (0.67s)
Compiling generated Java code. (1.39s)
Convert byte code - optimized dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACActionBar;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACActionMenuWrapper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACActionMenuWrapper$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACActionModeWrapper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACActionModeWrapper$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACButtonWrapper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACCheckBoxWrapper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACEditTextWrapper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lde/amberhome/objects/appcompat/ACFlatButtonWrapper;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:692)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.runDx(Main.java:293)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:684)
... 4 more

1615877421575.png
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
I deleted all previous AppCompat libraries and reinstalled 4.
The example Work.
However, i cannot understand, despite having the following code,

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

'Se utilizzi http
CreateResourceFromFile(Macro, Core.NetworkClearText)
AddApplicationText(
<uses-library
      android:name="org.apache.http.legacy"
      android:required="false" />
)

'Set activity in landscape
SetActivityAttribute(act_stampante_virtuale, android:screenOrientation, "landscape")
SetActivityAttribute(act_statistiche_tablet, android:screenOrientation, "landscape")


SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#222222</item>
        <item name="colorPrimaryDark">#222222</item>
        <item name="colorAccent">#009246</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
</resources>
)


' This is modify for SumUp-API
' First you have to ad these intent-filter
AddActivityText(paymentresult,  <intent-filter>
           <action android:name=".paymentresult"></action>
           <category android:name="android.intent.category.DEFAULT"></category>
           <category android:name="android.intent.category.BROWSABLE"></category>
      </intent-filter>)
' After that you have to replace the short-name .paymentresult with the package-namen and short-name.
AddReplacement (.paymentresult, com.xxxx.yyyy.gestione.paymentresult)
' You can use another name for the result-activity, but you have to change it in your starting
' Sub and here in the manifest-editor
SetActivityAttribute(act_lista_ordini, android:windowSoftInputMode, adjustResize|stateHidden)
SetActivityAttribute(act_lista_ordini_nostampa, android:windowSoftInputMode, adjustResize|stateHidden)


why for example the msgboxes i receive them in Dark mode if i compile with 10.70 ??

1615879091356.png


so the activity, etc.

If i compile the same code with version 10.60 the result is the following:

1615879242433.png


correct.
 
Upvote 0

Spavlyuk

Active Member
Licensed User
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Upvote 0
Status
Not open for further replies.
Top