(1.9) App runs on Emulator but not on device

rfresh

Well-Known Member
Licensed User
Longtime User
I created a variant using the new Designer Scripts window. For Droid2 smart phone, portrait 480x854x264. It runs at scale 1.5 with 240 DPI. In the emulator it looks great. I've tweaked the Designer Scripts window code. I created a landscape variant as well and tweaked that code for landscape...it looks great too on the emulator.

So I close down the emulator, connect my Droid2 to the IDE via USB cable and press Alt-3 to install it on the phone. It installs fine but when it displays, it looks like it does in the Abstract Designer (sort of a raw layout) which is to say, the new 1.9 Designer Script code didn't run to format its appearance properly.

Anyone have any ideas as to why the 1.9 Designer Script code doesn't run?

Did I forget to do something?

Thanks...
 

rfresh

Well-Known Member
Licensed User
Longtime User
I'm attaching my .zip file.

Thanks...
 

Attachments

  • ScreenTest.zip
    5.6 KB · Views: 219
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Yes, same here Klas...but when you try to install it on your device (at least on my two devices, a Droid2 and a Droid3) you will only see the 'raw' layout...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
On mine too. I hadn't tried it.
I moved the code from 480x854,scale=1.5
to 320x480,scale=1 160DPI and it works OK.

I suppose that's one of the reason why Erel always suggests to use variants with a density of 1 (160dpi).

Best regards.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I've played further on my Xoom and I am baffled. :eek: I cannot seem to get a variant specific script to run on it in an installed app. Using portrait mode I've tried 800 x 1280 scale 1 and that doesn't work. As the designer reports the Xoom as 800 x 1232 scale1 I've tried that and that also doesn't work. I guess I'm overlooking something but I can't see what that might be. :(
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
@Klas

Yes, I know Erel is always saying use 160dpi. I'm having a hard time wrapping my head around that for all devices. Why does creating variants support other dpi's then? I'm still going to have to think about this...it's just not clear to me yet.

It puzzles me that for my Droid2 with 240dpi I would use the 320x480x160 template and not create a specific template of 480x854x240 for the Droid2.

@Agraham

My core problem was, as you stated, because I didn't have any code in the All Variants Scripts section at the top. Once I put my code into that section, it rendered as expected on my Droid2.

Thanks to both of you...!!!
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I've played further on my Xoom and I am baffled. :eek: I cannot seem to get a variant specific script to run on it in an installed app. Using portrait mode I've tried 800 x 1280 scale 1 and that doesn't work. As the designer reports the Xoom as 800 x 1232 scale1 I've tried that and that also doesn't work. I guess I'm overlooking something but I can't see what that might be. :(

Look (with debug) at the resolution. On my Acer Iconia 10 inch tablet, its 800x1200 but when it runs, my code to check resolution shows not 1200 but 1154. I have a soft key area on the bottom at all times so I can't really get all 1200 pixels. I'm not sure if that's your specific problem or not but it was an issue for me.

B4X:
Sub Get_Screen_Resolution
   Main.pScreenWidth=GetDeviceLayoutValues.Width
   Main.pScreenHeight=GetDeviceLayoutValues.Height
   Main.pScale=GetDeviceLayoutValues.Scale
   If Main.pScale= 0.75 Then
   Main.pDPI="120"
   End If
   If Main.pScale= 1 Then
   Main.pDPI="160"
   End If
   If Main.pScale= 1.5 Then
   Main.pDPI="240"
   End If
   If Main.pScale=2 Then
   Main.pDPI="320"
   End If
   'Msgbox("Widht=" & pScreenWidth & " Height=" & pScreenHeight & " dpi=" & pDPI & " Scale=" & pScale  ,"ScreenDevice")    
   'Msgbox(pScreenWidth & "x" & pScreenHeight & "x" & pDPI  ,"ScreenDevice")
End Sub
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Resolved. My error. I had a line of code that modified the .Text property I forgot was in the code. This is a non-issue. Sorry.
--------------------------------------------------------------------
New issue. I have set a label text in the Abstract Designer to "12345".

In the Designer Scripts code, the following will change that label text as expected/shown below:

B4X:
lbl_Test.Text = "12345 text"

However, when the app is installed, the text modification does not show. The Abstract Designer default text is still there. The Designer Scripts tutorial shows that the .Text property is supported and in fact it does change it but not when the app is finally installed.

Anyone else experience this behavior?
 
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
My app is now working with no code in the All Variants section. Yesterday it would not execute the code in the Specific variant window. The layout would be the raw layout. Today the Specific code does execute to position the components.

I'm attaching the .zip anyway per your request.
 

Attachments

  • ScreenTest.zip
    7.6 KB · Views: 193
Upvote 0
Top