Android Question Intent error

Douglas Farias

Expert
Licensed User
Longtime User
hi all
i m trying to open a image to crop this

i m using this code

B4X:
    Dim i As Intent
    i.Initialize(i.ACTION_PICK, ParseUri("file://" & File.Combine(fp, "nao"&imgclicada&".png")))
    i.PutExtra("output", ParseUri("file://" & File.Combine(fp, "nao"&imgclicada&"2.png"))) 'output folder you set OpenCam(File.DirRootExternal, "1.jpg")
    i.PutExtra("crop", "true") 'crop ON
    i.PutExtra("aspectX", 0) 'crop aspects
    i.PutExtra("aspectY", 0) 'crop aspects
    i.PutExtra("outputX", 200) 'crop size
    i.PutExtra("outputY", 150) 'crop size
    StartActivity(i)


but dont works

how can i open a intent with a image on this ?

i dont want open galery or camera, only open a intent with a image to make a crop *-*
how can i
 

Douglas Farias

Expert
Licensed User
Longtime User
B4X:
           Case "Job3"
           'baixa imagem 
            out = File.OpenOutput(fp,"nao"&imgclicada&".png", False)
           Job.GetBitmap.WriteToStream(out,100,"PNG")  
           
            If File.Exists(fp, "nao"&imgclicada&".png") Then
           
            Log(fp&"nao"&imgclicada&".png")
           
           
    'StartActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/external/images/media/16")))
           
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, ParseUri("content://" & File.Combine(fp, "nao"&imgclicada&".png")))
   
    'i.Initialize(i.ACTION_VIEW, ParseUri("file://" & File.Combine(fp, "nao"&imgclicada&".png")))
    i.SetType("image/*")
    'i.PutExtra("output", ParseUri("file://" & File.Combine(fp, "nao"&imgclicada&"2.png"))) 'output folder you set OpenCam(File.DirRootExternal, "1.jpg")
    'i.PutExtra("crop", "true") 'crop ON
    'i.PutExtra("aspectX", 0) 'crop aspects
    'i.PutExtra("aspectY", 0) 'crop aspects
    'i.PutExtra("outputX", 200) 'crop size
    'i.PutExtra("outputY", 150) 'crop size
    StartActivity(i)

i m using this now, this open the intent with a blackimage, not my real image
what the error on this path ?
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
i m try this
B4X:
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, ParseUri("file://" & File.Combine(fp,"nao"&imgclicada&".png")))
    i.SetType("image/*")
    i.PutExtra("crop", "true") 'crop ON
    i.PutExtra("aspectX", 0) 'crop aspects
    i.PutExtra("aspectY", 0) 'crop aspects
    i.PutExtra("outputX", 200) 'crop size
    i.PutExtra("outputY", 150) 'crop size
    StartActivity(i)

but image dont found too

i make a log with fp,"nao"&imgclicada&".png" and the result is
/storage/emulated/0/Android/data/click.fight.google/files/clicknao1.png

in the intent have "file://"

its correct

file:///storage/emulated/0/Android/data/click.fight.google/files/clicknao1.png ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…