Share My Creation [Lib][B4A] Secondary Display

Hi guys,

Wanted to help out a fellow community member to achieve pushing views to a secondary display and I'm posting it on a new thread as suggested by multiple members. This is not the most elegant piece of code nor it is flexible. All it allows is, detect and push views to first secondary display it can find. That's all I wanted it to do in my project. So, I'll post it as is for now, and when I get more time I'll make it better.

Add both files to your Additional libraries folder. In your project, select the library, and use it as below,

Use:
Sub Class_Globals
    Dim Xui As XUI
    Dim SecondScreen As Secondaryscreen
End Sub

Public Sub Initialize
    SecondScreen.Initialise 'this will automatically search for second display. If found it calls back 'ReturningDisplayDimensions' with the dimensions of the secondary display
End Sub

Sub ReturningDisplayDimensions(Dimensions() As Int) 'called from the wrappped library if there is a second display
    Dim p As B4XView = xui.createPanel("")
    p.setlayoutanimated(0,0,0,Dimensions(0), Dimensions(1))
    p.LoadLayout("layout")
    SecondScreen.SetViewToScreen(p, False)
End Sub
 

Attachments

  • DualScreen.jar
    3.6 KB · Views: 64
  • Dualscreen.xml
    2.3 KB · Views: 65

aeric

Expert
Licensed User
Longtime User
I haven't check it. I afraid you get error object not initialized.
By the way, which hardware have you tested with this library?
 

AneeshJay

Member
Licensed User
I haven't check it. I afraid you get error object not initialized.
By the way, which hardware have you tested with this library?
I think that's only the case if it's a b4x class. Has to have that 'Initialize' function for it to set the internal 'Isinitialized' flag. Didn't apply to java wrapper libraries. Certainly didn't in my case.

It works on Sunmi D2S mini and D3 Pro (detachable rear display). These are only devices I have tested it on. But it should pretty much work with all Sunmi's and IMin's.
 

corradotisi

Member
Licensed User
Longtime User
Hi guys,

Wanted to help out a fellow community member to achieve pushing views to a secondary display and I'm posting it on a new thread as suggested by multiple members. This is not the most elegant piece of code nor it is flexible. All it allows is, detect and push views to first secondary display it can find. That's all I wanted it to do in my project. So, I'll post it as is for now, and when I get more time I'll make it better.

Add both files to your Additional libraries folder. In your project, select the library, and use it as below,

Use:
Sub Class_Globals
    Dim Xui As XUI
    Dim SecondScreen As Secondaryscreen
End Sub

Public Sub Initialize
    SecondScreen.Initialise 'this will automatically search for second display. If found it calls back 'ReturningDisplayDimensions' with the dimensions of the secondary display
End Sub

Sub ReturningDisplayDimensions(Dimensions() As Int) 'called from the wrappped library if there is a second display
    Dim p As B4XView = xui.createPanel("")
    p.setlayoutanimated(0,0,0,Dimensions(0), Dimensions(1))
    p.LoadLayout("layout")
    SecondScreen.SetViewToScreen(p, False)
End Sub
Hi,
I tried your library on SUNMI D3, it's great. But if i compile in "Release (obfuscated)" the program crash.
This is a known issue, could you fix it? See https://www.b4x.com/android/forum/threads/version-1-80-obfuscated-internet-connection.13983/
Thanks a lot
Corrado
 
Top