Android Question How to use if statement with additional res

ArminKH

Well-Known Member
hi
i've using some libs which has their own custom resources which we add them by #AdditionalRes
but for some reason i need to make changes into the resources then i have 2 Res folder for 1 Library
so i want use one of them by if statement some thing like this

B4X:
    If AppIsRight2Left Then
        #AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res1
    Else if AppIsLeft2Right Then
        #AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res2
    End If
is this possible? if not what is the solution?
tnx all
 

DonManfred

Expert
Licensed User
Longtime User
if not what is the solution?
Use donditional compiling (create two build configurations. One for left, one for right.

B4X:
#If AppIsRight2Left
#AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res1
#Else
#AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res2
#End If
 
Upvote 0

ArminKH

Well-Known Member
Use donditional compiling (create two build configurations. One for left, one for right.

B4X:
#If AppIsRight2Left
#AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res1
#Else
#AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res2
#End If
thank u but app language is changed by user in settings page and i want to change my resources based on language direction
 
Upvote 0

ArminKH

Well-Known Member
AppIsRight2Left Is saved in a sqlite db and i want to choose resources based on this property when activity_create raised
 
Upvote 0

ArminKH

Well-Known Member
The resources are compiled into the APK. You cannot replace the resources at runtime. You can manually choose the resources based on their keys.
yes i know but it's not my own library and i can't choose which resource should be used based on my settings
i can just add resources for that lib by AdditionalRes
You cannot replace the resources at runtime
my goal is some thing like Change Theme at run time
is this possible to ignore some resources when activity_create raised?
for example i have 2 resource like this
B4X:
#AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res1
#AdditionalRes: ../CustomLibRes/MSMaterialDrawer-Res/md-app/res2
is this possible to ignore res1 at run time?
 
Upvote 0
Top