Hi,
On one device I create a Panel for example by code. I then save the Panel, Top, Left Height and Width to a text file.
I then send that file to another device (Tablet) read the Top, Left, Width and Height and re-create by code.
My problem is the panel is not in the same position on the other device. I believe this is because of the dips.
Here is a sample of what I am doing
Values from each device as an example:
Logger connected to: Samsung S6 - ***** Phone *****
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
1dip: 4
Width: 1440
Height: 2560
Scale: 4
GetDeviceLayoutValues: 1440 x 2560, scale = 4.0 (640 dpi)
########################
Logger connected to: HUAWEI AGS-W09 - ***** Tablet *****
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
1dip: 1
Width: 800
Height: 1232
Scale: 1.3312500715255737
GetDeviceLayoutValues: 800 x 1232, scale = 1.3312501 (213 dpi)
I've probably got this all wrong but how can I save a panel, label, imageview etc on one device and send to another that has different scales resolutions etc and have them load in the same positions.
Any pointers or help would be appreciated.
On one device I create a Panel for example by code. I then save the Panel, Top, Left Height and Width to a text file.
I then send that file to another device (Tablet) read the Top, Left, Width and Height and re-create by code.
My problem is the panel is not in the same position on the other device. I believe this is because of the dips.
Here is a sample of what I am doing
Example:
' Create Panel On Device (Phone)
Dim TemplatePanel As Panel
TemplatePanel.Initialize("TemplatePanel")
Activity.Addview(TemplatePanel, 0dip, 0dip, 100dip, 100dip)
' Save Panel Layout
Dim TemplateWriter As TextWriter
TemplateWriter.Initialize(File.OpenOutput(File.DirRootExternal, "Template", False))
TemplateWriter.WriteLine(TemplatePanel.Top)
TemplateWriter.WriteLine(TemplatePanel.Left)
TemplateWriter.WriteLine(TemplatePanel.Height)
TemplateWriter.WriteLine(TemplatePanel.Width)
TemplateWriter.Close
' Send File To Different Device (Tablet)
' Load Panel Layout Onto Different Device
Dim TemplatePanel As Panel
TemplatePanel.Initialize("TemplatePanel")
Activity.Addview(TemplatePanel, 0dip, 0dip, 0dip, 0dip)
Dim TemplateReader As TextReader
TemplateReader.Initialize(File.OpenInput(File.DirRootExternal, "Template"))
Dim ReaderLine As String
ReaderLine = TemplateReader.ReadLine
ReaderLine = TemplateReader.ReadLine
TemplatePanel.Top = ReaderLine
ReaderLine = TemplateReader.ReadLine
TemplatePanel.Left = ReaderLine
ReaderLine = TemplateReader.ReadLine
TemplatePanel.Height = ReaderLine
ReaderLine = TemplateReader.ReadLine
TemplatePanel.Width = ReaderLine
TemplateReader.Close
Values from each device as an example:
Logger connected to: Samsung S6 - ***** Phone *****
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
1dip: 4
Width: 1440
Height: 2560
Scale: 4
GetDeviceLayoutValues: 1440 x 2560, scale = 4.0 (640 dpi)
########################
Logger connected to: HUAWEI AGS-W09 - ***** Tablet *****
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
1dip: 1
Width: 800
Height: 1232
Scale: 1.3312500715255737
GetDeviceLayoutValues: 800 x 1232, scale = 1.3312501 (213 dpi)
I've probably got this all wrong but how can I save a panel, label, imageview etc on one device and send to another that has different scales resolutions etc and have them load in the same positions.
Any pointers or help would be appreciated.