Android Question Scrollview screenshot, size problem.

Sub7

Active Member
Licensed User
Longtime User
I'm taking a screenshot of a scrollview with this code, the scrollview contain an image and a label that may contain up to 1500 characters.
The problem is that the more is "high" is the scrollview panel.height the more the screenshot dimensions are reduced, the width of the screenshot is reduced proportionally, i can't find better words to explain sorry.
If the text contained in the label is short then the screenshot dimensions are not reduced and it looks good.


B4X:
Dim Obj1, Obj2 As Reflector
  Dim bmp As Bitmap
  Dim c As Canvas
  Obj1.target = Obj1.GetActivityBA
  Obj1.target = scrollview.Panel
  bmp.InitializeMutable(Activity.Width,scrollview.Panel.Height)
  c.Initialize2(bmp)
  DoEvents
  Dim args(1) As Object
  Dim types(1) As String
  Obj2.target = c
  Obj2.target = Obj2.GetField("canvas")
  args(0) = Obj2.target
  types(0) = "android.graphics.Canvas"
  Obj1.RunMethod4("draw", args, types)
  DoEvents
  Dim out As OutputStream
  out = File.OpenOutput(File.DirRootExternal&"/folder" , Filename, False)
  bmp.WriteToStream(out, 100, "JPEG")
  out.Close
 

Sub7

Active Member
Licensed User
Longtime User
Hello Erel, i have exported some code, the result is a very small image.


Thanks for your time
 

Attachments

  • shot.zip
    9 KB · Views: 313
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
bmp height is correct:

SS-2015-03-02_15.47.31.png
 
Upvote 0

Sub7

Active Member
Licensed User
Longtime User
Have you seen the result file?
to me it looks something like this in attachment.

67x801px

67 no good!
 

Attachments

  • unnamed.jpg
    unnamed.jpg
    8.6 KB · Views: 256
Upvote 0

Sub7

Active Member
Licensed User
Longtime User
Nevermind, i found the problem. I was saving the image from google gmail preview instead of downloading it :>

Thanks.
 
Upvote 0
Top