Android Question problem with imageview

3394509365

Active Member
Licensed User
Longtime User
I have to upload a photo in full screen and I started to write something, but I upload a blank page, if I exclude the sub Sub CreateScaledBitmap then the photo is uploaded, but of course I would like the option of power zoom in a bit.

what c 'is wrong?

this is the error :

(Intent) Intent { act=android.intent.action.MAIN flg=0x20000000 cmp=b4a.example/.main }
no extras



B4X:
#Region  Project Attributes
    #ApplicationLabel: provacaricafoto
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
  Dim b As Bitmap
  b = LoadBitmap(File.DirRootExternal, "xxxxx.jpg")

    'ImageView1.Bitmap=(LoadBitmap(File.DirRootExternal, "/external_sd/Repertorio JPG/Asia.jpg"))' nella cartella repertorio della scgeda sd esterna

  b = CreateScaledBitmap(b, 16, 16, True)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int, Filter As Boolean) As Bitmap
  Dim r As Reflector
  Dim b As Bitmap
  b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
      Array As Object(Original, Width, Height, Filter), _
      Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
  Return b
End Sub
 

sorex

Expert
Licensed User
Longtime User
you have a space in the path, replace it with %20 and see it that helps

Edit: sorry, I thought the problem was in the line tha was commented but you described another issue.
 
Upvote 0

bluejay

Active Member
Licensed User
Longtime User
The line
b = CreateScaledBitmap(b, 16, 16, True)

should be
ImageView1.Bitmap= CreateScaledBitmap(b, 16, 16, True)
 
Upvote 0
Top