Canvas Into Image

As a starting point, try like this:

image

Will the image save in gallery?

To display the image in the gallery see the advice provided above.

I followed the advice but I am unable to save the image in gallery.

You have the path to the file, why do you need the gallery ?

You could save your file paths to a list, and recall these, displaying the image in an image component (one at a time) for selection

It's best to hold off on this app until a new version of AppInventor is released. There will be new blocks that will allow writing to shared folders.

How could I do that? Please help in that.

Learn about using lists:

General Tutorials

@Sarthak

Save canvas, then view in Gallery
viewCanvasInGallery.aia (57.3 KB)

Find here an aia project that "currently" works for me on Android 10 and Android 11 in companion mode. This will probably "break" once AI2 targets API 30 (next update n187). You need two extensions from Taifun: File and Tools .

The canvas image is saved to its default location, then copied to the shared/common Pictures folder. The gallery is refreshed for the canvas file name.

Blocks

When n187 arrives, you should be able to use the new File component to place the canvas image in a Shared folder.

1 Like

I know a way to save the image in gallery.
Step 1 : Click on the main Screen of your project (by default it is Screen1)
Step 2 : Click the option FileScope and change its value to shared.
Step 3 go to blocks Editor and join the following piece of code before your file name

DCIM/Camera/

Make sure to join this before the file name.

Now add a Callnotifier block and add the Canvas .saveas block to it.
Next join the file name.
This will save it to your device's Camera Folder.
You may create a different folder too but saving it in the camera folder will be better.

Btw, I program in my android. so pls manage from the image.

You have no need to add any extension for this. Sometimes, the Gallery doesn't update. If that happens, just remove both the app and gallery from your device background. But if it still doesn't load, the only thing you can do is restart your phone ( cuz that's a problem in your Gallery ). I face this actually but when I reatart my device, the image comes in my Gallery.

Also, I have provided you with the share option. You may share images from there.

Thank you.

Which Android versions have you tested?

Actually, I have an Android 6 at present, but I know this would work in other versions too as FileScope Shared works in all versions above Android 6 (I don't know if it works below Android 6 or not.) And actually I wrote 0/ by mistake, in my reply but I omitted it.

Your method does not work in Android 11, because you have an extra 0/. Even when I tried this:

image

  • only appears in the File Manager and not in the Gallery, only after reboot.

  • I have a stopwatch, and it has recorded 2min 33sec, and I still have not seen the image saved in the gallery unless I reboot the device.

See I removed the 0/ even before you replied. I know I made a mistake there.

1 Like

Does not work unless I reboot the device even after removing. I recommend Taifun Tools by @Taifun. It has a GalleryRefresh block.

Why do we need this?
Currently after drawing something and saving the canvas, the drawn image does not appear in the gallery of the device. It appears only after rebooting the device or using an app like Gallery Refresh, but that app only works for older Android versions. The new block "GalleryRefresh" fixes that issue for all Android versions.

Ok let me try that then cuz I'm also having problems with gallery refresh.

Its not working still.

I altered the code many times, but it still doesn't work, atleast for me.

It would really help if you provided a screenshot of 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


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

3 Likes

Here it is.

Pls help @Taifun

I made many alterations but still it doesn't seem to work.


please provide a screenshot including Do it result

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like