Android Question NightMode for B4XPAGES.

netsistemas

Active Member
Licensed User
Longtime User
Whats is the best thenic for view o design o change, the layout to NightMode.

I can change all layout to Black (background) an white (Ink/Foreground), instead white (background) and grayed buttons.

I need this for B4A and B4J (B4X).

(I go to find, too, change backcolor in b4xpages)

No change nightmode for phone, only in view for my app (easy and fast, and for new layouts, may be, set defaults color in b4x designer).
 

Attachments

  • WhatsApp Image 2020-10-22 at 19.43.56 (1).jpeg
    WhatsApp Image 2020-10-22 at 19.43.56 (1).jpeg
    44.9 KB · Views: 144
  • WhatsApp Image 2020-10-22 at 19.43.56.jpeg
    WhatsApp Image 2020-10-22 at 19.43.56.jpeg
    51.2 KB · Views: 155

TILogistic

Expert
Licensed User
Longtime User
This is what you are looking for??
Custom theme:

B4A:



or


B4J:

JFX Style
 
Last edited:
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
Acording to last message from Erel: (no error, but no work)
1. reference appcompat
2. Add code to manifest:
B4X:
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    </style>
</resources>
)
3º include function in Main (proyect B4XPage)
B4X:
Sub SetDefaultNightMode (Mode As Int)
    Dim jo As JavaObject
    jo.InitializeStatic("androidx.appcompat.app.AppCompatDelegate").RunMethod("setDefaultNightMode", Array(Mode))
End Sub
4º Execute funciton from activity_create (is correct?)
B4X:
Sub Activity_Create(FirstTime As Boolean)
    SetDefaultNightMode(1) '2 no ok
    ...

But not work.
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
No, i added this to #region Proyect attributes (main) and the app no open.
B4X:
#Region  Project Attributes
    #ApplicationLabel: Aplicacion DEMO RAV
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
    #Extends: android.support.v7.app.AppCompatActivity
    
    #if b4j
        #AdditionalJar: mssql-jdbc-8.4.1.jre11
        
    #else
        #AdditionalJar: jtds-1.3.1.jar
    #end if
    
#End Region
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
there are not message in any case.
No with #extendes clausule (no run app)
No with out clausule

Some mini sample? please?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Are you running the app in Debug mode?
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
yes,
both of them: debug and release
this has to be easier than it seems .
Something basic in b4x I have not learned about 'THEMES'.
 
Upvote 0
Top