Problems copying a screenshot from the app folder to the Android Gallery

Hi Everyone,

I’m new here but not new to App Inventor. So far I have muddled along on my own and managed to sort out my app related problems. I now have an issue with copying a screenshot from the app folder to the android gallery that I have been unable to resolve. I am using an old OnePlus A3003 mobile running Oxygen o/s. The jpeg is captured okay (Using Taifun Screen shot and Taifun Tools extensions) but returns file not found errors when doing the copy. I have uploaded the blocks and error messages below, hoping someone may be able to help. The app is just a tool to help me understand how the screen capture and file copy works.

Thanks

Ron

the file component expects relative paths. i.e.

fromFileName: screenshot.jpg
toFileName: /Pictures/...

Taifun

Thanks for replying so quickly!

So just to clarify as I’m no expert are you saying replace the Get Image block with a text block saying just ‘screenshot.jpg’ and the To FileName should just say ‘/Pictures/‘

Apologies for needing hand holding!!

Yes, try it...

This is what I’ve tried and the app now doesn’t respond at all..

Are you setting the filename to save to screenshot.jpg ?

If so, did the file copy from the ASD to shared storage /Pictures ?

What is the clock for ? ( you should set the interval before enabling the clock). If it is to create a delay for the Gallery Refresh call, then that call should be made in the Clock Timer event (where you also turn of the clock)

This works for me (have not done the GalleryRefresh part yet, let us get the screenshotting and copying working first)

The file (default filename screenshot.jpg) saves to the ASD but does not copy and the app hangs since I made the changes from the original posted config.

I removed the clock blocks.

Did you also remove the GalleryRefresh block ? Could be trying to do this at the same time or before the copy is completed ?

No the gallery refresh block is still there as below

Then remove it. What happens ?

Just copying your blocks, back soon..

With GalleryRefresh and unique filename

If you want, you can also add these blocks to the end of the clock timer event, to delete the image from the ASD

image

Just replicating your blocks, back soon!

I have replicated the blocks and tried it but still not working. I need to check carefully through what I have done and see how I get on. I may have made a mistake in my haste!

Thank you so much for spending your time in trying to help me, I will definitely come back and let you know how I get on!

Thanks again for your assistance

Ron

It would really help if you provided a screenshot your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun

Hi Taifun,

My first post included an image containing the screenshot of the blocks and the errors I initially experienced. I have also replicated the blocks as provided by TIMAI2.

All I am really trying to do is to take a screenshot image using a button in an app and then renaming and transferring it to the phones ‘Pictures’ folder.

Basically I just need the blocks to do this with the file names and paths (the File name can be anything). The issues I am having seem to be caused by the From and To parts of the File Copy block. The small app I have created is purely to enable me to get this copy process working, following which I want to use the technique in another larger app.

When I replicated the blocks supplied by TIMAI2 the screenshot was captured but the app then hung and the copy didn’t take place.

Any help much appreciated.

Ron

I have seen your initial screenshot and I have seen the screenshot from @TIMAI2 . But I have not seen a screenshot of what YOU tried after all the help which has been offered

Tip: try it first without clock and Gallery Refresh

Taifun

1 Like

Hi Taifun,

I have cut it back to a minimum and still get the same errors as in my original post, the blocks are below

Thanks for your help

  1. you didn't copy my blocks...
  2. "image" returns the absolute path to the screenshot:

so you are repeating what you did in the first place by adding a file path to the screenshot image name.

Hi

I did replicate your blocks but the app hung and appreciate that you are trying to help me. I have replicated the simpler version as below and it still hangs. Apologies I seem to be making a meal of this, but I am trying guys.