Android Question How to add screenshot to screenshot map

andredamen

Active Member
Licensed User
Longtime User
I know how to make a screenshot within the app and sent it to the mediamap:

B4X:
MediaStoreImagesMedia.InitializeStatic("android.provider.MediaStore.Images$Media")

But how put it into the screenshot map?
 

Sandman

Expert
Licensed User
Longtime User
Sorry, no. If I had known it, I would have written it. I imagine you could find the answer by using the search engine, seems like something that has been discussed several times before.
 
Upvote 0

andredamen

Active Member
Licensed User
Longtime User
I spend this afternoon a lot of time in the search engine. Didn't find the solution. Does anyone know?
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Not sure if I understand what you mean.

Maybe you could use this example and change Pictures with Screenshots?

 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
What, the attached project is not working for you @andredamen???

What device are you testing it on???
 

Attachments

  • AddPhotoToGalary.zip
    48 KB · Views: 177
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hi Peter:

I've made the same test. It works, but andredamen wants the picture appears under the "Screenshots" album, and not into the "Pictures" one (In my image, Capturas means Screenshots)

screenshot.jpg
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Erel can't find the settings to create folders into "Pictures"...

 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Well, I've been lucky. Looking I found this, and probably not related, but I tested this way and it works.

Changin this line it works (add the "%/Screenshots/%" & part).

B4X:
cr.Delete(EXTERNAL_CONTENT_URI, "_display_name = ?", Array As String("%/Screenshots/%" & TargetName))

I have no device with target <29 to test the else part of the Erel's snippet, but you should test with "Pictures/Screenshots" there.
 
Upvote 0

andredamen

Active Member
Licensed User
Longtime User
Doesn't work with me. I work with sdk version 30. On my tablet in the folder " Images" there is no folder names "Pictures" I have changes the line in the AddPhototoGallery app to:

B4X:
        cr.Delete(EXTERNAL_CONTENT_URI, "_display_name = ?", Array As String("%/Screenshots/%"& TargetName))

The app makes a folder "Pictures" in the folder "Images"en puts the image in that folder.

The EXTERNAL_CONTENT_URI = "(HierarchicalUri) content://media/external/images/media . I think that I can't change that and that this is the problem.

Still I can not put a screenshot made with my app in the folder "screenshots". It is strange José that it works with you. Did I do something wrong?
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Did I do something wrong?
No, I think you didn't, I think is just our phone manufactures, uses differents folders names for saving the pictures.
Save a screenshot to see where your phone saves it. Maybe the name is different.
Sorry, I don't know a general way of making it works for any phone
 
Upvote 0
Top