Hi everybody, i have a issue with sharing component. Well that i want to do is the following:
i have a button, when i press this button i want to share a photo and a message, so, i write the path of the photo that i want to share and the text of message... but in some phones this works and in others doesn't work.. because the path isn't the same in all phones. (view the example attached)
Well, how could do this to it work in all phones?
Thanks so much, and sorry for my english, i'm learning english...little by little hahaha
--
you can't share files uploaded as assets into your app
your example only works on your development device...
--
Thank, but isn't it that i want
I want to share a picture which i have uploaded to the project. Not pick a picture from gallery or storage.
How could do this?
--
you could first save it on sdcard using the Canvas.SaveAs method, see also here
and then share it
--
Okay, so i save the image of canvas and then i share it, putting the path where the image of canvas it was saved?
And one thing more, after i have saved the canvas image and i've shared it, i could delete the canvas image from storage? If it is possible, how can i do it?
And one thing more, after i have saved the canvas image and i've shared it, i could delete the canvas image from storage? If it is possible, how can i do it?
--
Okay, so i save the image of canvas and then i share it, putting the path where the image of canvas it was saved?
that sounds like a good idea... just try it...
remember: the sharing component expects the full path to the image, which starts with file:///mnt/sdcard, see also How to take a picture or pick an image and share it
And one thing more, after i have saved the canvas image and i've shared it, i could delete the canvas image from storage? If it is possible, how can i do it?
as far as I know, this unfortunately is not possible
--
I will try this. What is the default path where canvas image is saved?
And i don't know if in the all of phones will be same, for example: may be in one phone the image is saved in one path and in other phone is saved in a different path...
PD: Wow, i like so much this forum, is very helpful to help everyone to solve his issues. All of my problems and break-heads have been solved here, nice ;)
And i don't know if in the all of phones will be same, for example: may be in one phone the image is saved in one path and in other phone is saved in a different path...
PD: Wow, i like so much this forum, is very helpful to help everyone to solve his issues. All of my problems and break-heads have been solved here, nice ;)
--
I will try this.
great idea!
What is the default path where canvas image is saved?
the default path is the root directory of the sd card
And i don't know if in the all of phones will be same, for example: may be in one phone the image is saved in one path and in other phone is saved in a different path...
it is you who defines in with path it will be stored in the Canvas.SaveAs method...
btw. it also helps to take a look at the documentation http://ai2.appinventor.mit.edu/reference/components/animation.html#Canvas
text SaveAs(text fileName)
see also tip 2 here
--
Well...if the canvas image save the image in the root of sdcard the path to obtain the image is:
file://mnt/sdcard/icon.png
And it is valid for all the devices and all the versions of Android?
--
yes
file://mnt/sdcard/icon.png
And it is valid for all the devices and all the versions of Android?
--
yes
--
the canvas must be visible and width and height must be > 0
--
Ahhh okay, that is the problem. I had the canvas no visible...
But i don't want have the canvas "visible"
How can do i it? Have any other way?
But i don't want have the canvas "visible"
How can do i it? Have any other way?
--
Try make the canvas visible just before save and then hide it again straight after save.
--
probably a timing issue? you can use a clock component as solution like this:
set the canvas visible and start the clock (test with a timer inveral of 10milliseconds)
in the clock.timer event first save the canvas, then set the canvas visible = false again and share the image
--
Yes, now it's working! : D
Finally, they are in no way to hide the canvas When the timer put it as "visible" for 10 milliseconds ?
PD: I'm testing the application, and the first time When playing the button " Share " canvas image is saved but the application subject me as "Can not find file: // ......" and the application does not share the image
And the second time , when I touch the button " Share " is a work perfectly, and save and share the image well
I don't know why it happens this... Any ideas?
--
they are in no way to hide the canvas When the timer put it as "visible" for 10 milliseconds ?
as already said, the canvas must be visible, but you can try a timer interval of 0 or 1 millisecond
the first time When playing the button " Share " canvas image is saved but the application subject me as "Can not find file: // ....
use a second clock and wait a little bit again before sharing
--
Finally, i have done, with two clocks :)
Thanks you so much, when i finish the app i will mention you on the credits, i promise.
--
댓글 없음:
댓글 쓰기