Android Question Intent.ACTION_PICK with Nexus

gerardguerin

Member
Licensed User
Longtime User
Strange bug, I have a ImageView with a click to select a picture and crop them and display, that work well on all device except on the Nexus device.

Testing device: Nexus 5, Android 6.0.1

Any idea about what wrong?


B4X:
sub imgUser_Click
   onoff = True
   Dim Intent As Intent
   Intent.Initialize(Intent.ACTION_PICK, "")
   Intent.SetType("image/*")
   Intent.PutExtra("crop", "true") 'crop ON
   Intent.PutExtra("aspectX", 1) 'crop aspects
   Intent.PutExtra("aspectY", 1) 'crop aspects
   Intent.PutExtra("outputX", 100) 'crop size
   Intent.PutExtra("outputY", 100) 'crop size
   Intent.PutExtra("output", ParseUri("file://" & File.Combine(File.DirRootExternal, "temp.jpg")))
   StartActivity(Intent)
end sub

Sub Activity_Resume
   If onoff = True Then
     'Verification si photo exist
     If File.Exists(File.DirRootExternal, "temp.jpg") Then
       onoff = False
       imgUser.Bitmap = LoadBitmap(File.DirRootExternal, "temp.jpg")
     End If
   End If
End Sub
 
Last edited:

gerardguerin

Member
Licensed User
Longtime User
Yes I finally found my solution. I use ContentChooser with a function to crop after select the image.

Sample code I use and the "Crop" bas/bal

B4X:
Sub Process_Globals
   Dim Chooser As ContentChooser
End Sub

Sub Activity_Create(FirstTime As Boolean) 
   Chooser.Initialize("ImageSelect")
End sub

Sub BtnImageSelect_Click
   Chooser.Show("image/*", "Select an image")
End Sub

Sub ImageSelect_Result (Success As Boolean, Dir As String, FileName As String)
   If Success Then
     Starter.ImageDir = Dir
     Starter.ImageName = FileName
     StartActivity(Crop)
   Else
     ToastMessageShow("No image selected", True)
   End If
End Sub

I hope this help
 

Attachments

  • Crop.bas
    2.4 KB · Views: 423
  • crop.bal
    2.8 KB · Views: 358
Upvote 0
Top