Android Question Scrollview screenshot, size problem.

Discussion in 'Android Questions' started by Sub7, Feb 28, 2015.

  1. Sub7

    Sub7 Active Member Licensed 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.


    Code:
    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(1As Object
      
    Dim types(1As 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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Your code looks correct (though the DoEvents calls should be removed).

    What is the height of bmp?
     
  3. Sub7

    Sub7 Active Member Licensed User

    Hello Erel, i have exported some code, the result is a very small image.


    Thanks for your time
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    bmp height is correct:

    [​IMG]
     
  5. Sub7

    Sub7 Active Member Licensed User

    Have you seen the result file?
    to me it looks something like this in attachment.

    67x801px

    67 no good!
     

    Attached Files:

  6. Erel

    Erel Administrator Staff Member Licensed User

    What is the output of Log(bmp.Height)?
     
  7. Sub7

    Sub7 Active Member Licensed User

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

    Thanks.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice