Android Question Different Quality Image of ImageView

rad

Member
Licensed User
Hi guys can anybody help me...

I have trying to get image from galery using intent

B4X:
Sub imgView_Click
    Dim i As Intent, Directory As String, PictureName As String

    Directory = File.DirDefaultExternal 'File.DirRootExternal
    PictureName = "radtemp.jpg"
  
    i.Initialize(i.ACTION_PICK, "")
    i.SetType("image/*")
    i.PutExtra("output", ParseUri("file://" & File.Combine(Directory, PictureName))) 'output folder you set OpenCam(File.DirRootExternal, "1.jpg")
    i.PutExtra("crop", "true") 'crop ON
    i.PutExtra("aspectX", 1) 'crop aspects
    i.PutExtra("aspectY", 1) 'crop aspects
    i.PutExtra("outputX", 256) 'crop size
    i.PutExtra("outputY", 256) 'crop size

    StartActivity(i)
End Sub

and the result i put in 2 imageview using

B4X:
imgView.Bitmap = LoadBitmapSample(File.DirDefaultExternal, "radtemp.jpg",100%x, 100%y)

in one activity which is one imageview created using designer and the other created on the fly using imgView.Initialize("imgView").

The Question is, why the result are different?
- imageview from designer is croped perfectly
- imageview from initialize is croped badly

My Project have to use imageview from initialize....
 

rad

Member
Licensed User
Unfortunately you don't give enought information!
Post a small project showing the problem, so we can see what exactly you have done and how.

Hi Klaus, thanks for your attention...
Here is small project to discript the problem of imageView.

Library Needed:
- Java Object
- Reflection
 

Attachments

  • b4aGetPict.zip
    423.2 KB · Views: 88
Upvote 0

klaus

Expert
Licensed User
Add this line in Acrivity_Create:
ImgViewOTF.Gravity = Gravity.FILL
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
   
    ImgViewOTF.Initialize("ImgViewOTF")
    ImgViewOTF.Color = Colors.ARGB(255,200,200,200)
    ImgViewOTF.Gravity = Gravity.FILL
    Activity.AddView(ImgViewOTF, 0 , lbl2.Top+lbl2.Height, imgViewVD.Width, imgViewVD.Height)
   
End Sub
 
Upvote 0

rad

Member
Licensed User
Hi... Klaus, its run exactly like what i want....
I have trying this way before... but the different with yours is...

i put
ImgViewOTF.Gravity = Gravity.FILL

before
ImgViewOTF.Color = Colors.ARGB(255,200,200,200)

have you try this....?
But thank you so much anyway...
 
Upvote 0
Top