2017년 4월 15일 토요일

search for Speed of the finger on screen


Hello together. I'm new with app inventor. I'd like to do an app which lets the phone vibrating, if you move your finger on the screen. As faster you're ...
This is what I want, but with the user creating the motion by dragging his finger around and around the center of the screen. So far I have tried using ...

Dragging a sprite around a circular axis using touch.


Hello everyone. I'm new to ai2 and this forum too, I hope someone can point me in the right direction.

I need to create a very simple screen, where you drag a ball (sprite) around an invisible center.
So imagine a circular axis with a "ball" on it. And when you try to drag the ball, the ball will remain on the point on the axis closest to your finger.
Hope it makes sense.

--
Is > this < what you mean?

--
No sorry, this is just centering an object. I want to move it AROUND the center, by dragging it.

--
Like the hands on a clock?

--
I made a bad gif of what I mean. Imagine someone dragging them in this circle. Without user interaction, they would be still.

http://oi59.tinypic.com/2hfqs0h.jpg

--
If you keep adding 1 to the sprite's heading in a fast clock it will cause it to spin around its upper left corner.
Both your red and blue sprites share a corner, but one is 180 degrees away from the other in its heading.
Here's a simple spinning red line to try...



--
Abraham's solution works to attract a ball to a touched point.
If you need the balls to rotate about each other ...

The Canvas and ImageSprite PointInDirection blocks allow you to rotate an ImageSprite by changing it's Heading value so that it points to an x,y location that you touch.

I tried it with both the Canvas and ImageSprite versions and they both work for your example.
If you would have more than one set of balls on the canvas you would need to use the ImageSprite version for each set of balls (unless you wanted them all to point to where you touch).
The image I used for this was one layer from your example jpeg file.
--
Great. Apparently all of my previous answers are on mail.
But I've try again. I'm am almost there, thanks to the last post.
This is what I want, but with the user creating the motion by dragging his finger around and around the center of the screen.


So far I have tried using (StartX - StartY) + (CurrentX - CurrentY) to dimiter the speed of the rotation.
It looked really cool, but it wasn't exactly what I wanted.

Thank you all for your answers, I really appreciate it. And I want to do my own work, I usually do. Just can't wrap my head around this one.

--
That is exactly what > TwoTouch.aia < does. Click the link to download it then import it to try it out.
You drag your finger anywhere on or near the circles and they will spin happily.
It does this using the PointInDirection block.

--
Thanks a lot for all the help. This is perfect! I will post the finished app here when I'm done.

--
Please do NOT post the application APK here... read the posting guidelines.  If you want to post a link to it, that's fine.

--
I'm not, I'm posting the .AIA. Without the "source code" it's pretty useless to people here..

--
I don't see what is allowed to be posted in the Welcome message. 
Is is somewhere else?

--
Here are the posting guidelines: Posting Guidelines

--
Got it. Thanks.

--

High Scores with Tinydb in AI2 - Simplified (lesson)


Hello, I just wanted to post this real quick for anyone who may be looking for this.   I was looking all over the place for tutorials for how to use Tinydb to store highscores and all i found were huge pages of lessons and some unexplained procedures etc.   All mainly shown in AI1 as well.
Well, for anyone new who is just starting to learn App Inventor...let me save you some headaches with Highscores for  
your game.

For one single highscore on one single screen.... this is literally ALL you need to make it work.

Now let me explain.   First off... Screen1 is a copy/paste version from my working program thats why you see the red flag.  I just wanted to isolate just what you need to know.

1- create a procedure and name it.
2- find the label you use to post your final score at the end of your game.  Mine is FinalScoreValueLabel.
3- where you see FinalScore > HighScoreLabel.....I created a high score page in my options.  The highscore is that label.
So basically that entire if loop says:  if the score i just got in the game is higher then what ever my current highest score ever is, then make my game score the new high score.  Obviously if its not higher then it will not do anything,

*I keep all the names close togather so it may look a bit confusing, but the purple box that says:  call HighScore.store value is not the highscore label....this is my Tinydb renamed to HighScore.

4-within your Tinydb drawer, select this block i have in the pic.  the:  call Tinydb.StoreValue block  In the tag, that was written on the spot, this is where you define the name of the tag to be stored on your phone.  I named mine HighestScore
ValueToStore:  this is the highscoreLabel.text ---  from my highscore page in my options.  The same one from the if loop.

Basically, if my score of the game is higher then the highest score, it changes to the new score otherwise it does nothing.  but weither the high score changed or not, the program keeps what ever the Highest score is..stored.

At the bottom of the pic is the single call procedure to call this entire thing,   You need to slot this in where ever your function that results in the game being over is.

Finally, the screen initialize block: 
5-  you need to call the highestscore tag that is saved on your phone when the screen first starts up.  This is the call Tinydb.getvalue.  block
I used this particular GetValue box for a reason:   The tag is obviously calling the name you saved it under on your phone from earlier.   But the other item....valueTagNotThere.....this needs to be set so that the very first time you load up your phone, there will obviously be nothing stored on your phone yet, but as we all know...computers need absolutely everything spelled out for them.  Without this tag, the computer will try to find a saved item that does not exsist yet.   Remember....the highestScore Procedure does not run until the program is already running, you finished a game and got a score.  So this GetValueBox in Screen Initialize will read waaaaay before you ever get to actually storing your first score.  So this is a very important step.  You NEED to define a value for when theres nothing to look up for the first time.

My explaining is way more work then building the actual blocks :)   I know there are alot of tutorials about Tinydb, but like i said.  I wanted to spell it out in my own words for new comers.   And for AI2.   There is no need to jump right to all the big stuff first shot like storeing 10 items on 3 different screens etc.
Understand whats happening first....then you wont need to look up a tutorials for the complex stuff when you get to it,,,, babysteps.

Hope it helps!

--
Thanks for sharing that, richard. That is a good, simple method that should prove to be very useful :)

--
Thanks a lot very helpful tips and simple indeed. I too found other tutorials on high scores a bit confusing and mainly on AI1 but you method is first class for beginners.

--
I have used this method and its fine and simple. But I have now started to work on a second screen and understand from other posts that I have read I cant use another TinyDB in my second screen?? So using the method I have got from here How do I go about saving a high score on my second screen????

I have read the colour dot tutorial if that's going to be suggested but I can't work through that method it goes over my head.

--
That's NOT correct Sid... You can use a TinyDB on EVERY screen if you want, but they will ALL use the same file, regardless of what you call the component.  For example, on Screen1 you have a TinyDB1 and you leave it's name as that.  On Screen2, you have a TinyDB but you called it TinyDB2.  Screen1 and Screen2 will share the same datastore.  You can't set up multiple databases with TinyDB for the same app.

--
As a follow up to Enis answer.
For a second screen that has separate data just use a different tag name to keep that data separate from the first screen's data.
You  can, however, access the data stored in the TinyDB from the first screen in the second screen with the tag name used in the first screen.

--
Thanks a lot, thought I would ask before I tried it and yes it worked on the other screen as I took both your advice and created another tag and used another TDB.

Amazing forum and the best support from all.

--
Thanks Sid!  We all appreciate that!  So glad you got it all figured out!
--

Having issues with saving and retrieving files


I am working on simple app to store statistics.  I want to be able to save a file, etc..  However, ever time I try to access the file it is giving me either a 2101 or 2001 error.  I am using a Galaxy S6, which does not have an sd port.  I wasn't sure if that was the issue or just my code.  Any help would be greatly appreciated.  

--
do you get issues while saving the file or while reading the file?
according to the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#File, the AppendToFile method should also work in case the file does not exist

AppendToFile(text text, text fileName)
Appends text to the end of a file. Creates the file if it does not already exist. See the help text under SaveFile for information about where files are written.

usually you would use a file name with extension, for example SteveMarquette.txt ...
what happens, if you use the SaveFile method?

--
I cannot find the file on my device.  That is why I was wondering if you could save on a device without an SD port.  
I have tried both the Save and Append command, in either case I cannot find the file, even when I search I my phone manually. 

Ideas?

--
see again the documentation: 
http://ai2.appinventor.mit.edu/reference/components/storage.html#File
you are using a filename without slash, which means, you store the file in the private data directory, however if you test using the companion app you should be able to find the file


SaveFile(text text, text fileName)
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard (for example, writing to /myFile.txt will write the file to /sdcard/myFile.txt). If the filename does not start with a slash, it will be written in the program's private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to /sdcard/AppInventor/data to facilitate debugging. Note that this block will overwrite a file if it already exists. If you want to add content to a file use the append block.

--
I notice the given blocks don't add a ".txt"  suffix to the file name.
On Windows, the suffix is used to pick program associations.
Is that a problem for Android and AI2, besides being poor practice?

--
Having same problem I would like to save text to a picture but you are able to text your own message any ideas?


--
@Lieb: you have a completely different question...

to write text onto a picture you have to use a canvas, display the picture as canvas background image and use one of the DrawText methods to write the text, then save the canvas (which is the picture including the text)

--
I can write text to the picture i just cant get it to save, sorry

--
protip: it helps to provide a screenshot, else we do not know, what the problem might be...


--
So, I have been trying different ways to get my program to work.  I have been using both my mobile and a tablet (neither of which have an SD card).  I'm not sure if it is saving my file.  I do not get an error unless I try to share the file and it will say file not found.  I have tried many different combinations of the file names from the documentation, but I must be missing something.  I have attached one attempt.  Not sure where to go from here.  I have read the documentation on sharing and saving files, but thank you for the suggestion.  


--
 I have been using both my mobile and a tablet (neither of which have an SD card).
you are storing in the internat sdcard...

the correct path for the Sharing component is file:///mnt/sdcard/SteveMarquette.txt

--

Sharing High scores


I'm trying to add an option to share the high score that is stored in a tiny db via social media. I have the social function, the button and the tiny db already set up. I've provided a visual representation of what I already attempted. Every time I press the share button, it gives me a message saying, "Error 2001: The File file://18 could not be found on your device" 18 is the current highscore saved in the tiny db. Thanks in advanced!

--
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.

--
I forgot to include the screen captures, sorry!



--
instead of the ShareFileWithMessage method use the ShareMessage method 
and use the join block to join together your message

--

Creating Error Log


I'm trying to develope a method to create an Error Log, so I can store information about errors that happens in larger apps, in order to fix them faster.

This is the way I want to do it, but it stores anything at the existing ErrorLog folder. Not even the screenshot.
Button3 should cause the error to store.

Thanks in advance.

--
use Do it to check, if the name is a valid directory name
how do you test that functionality? do you have something, which triggers an error?

did the screenshot example work for you as it is without modifications?

--
Button3 (as it is in my image) should trigger an error (as it tries to select the second item of an empty list).

In the same app I have another button that takes an screenshot and saves it in the same directory, so the screenshot extension works and the directory should be a valid one.

I guess then that this doesn't launch the error ocurred event:
What is an error to AppInventor then?

--
see a complete list of errors, which will trigger the ErrorOccurred event below

  // Phone version errors
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_CONTACT_EMAIL = 1;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_EMAIL_PICKER = 2;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_FUSIONTABLES_CONTROL = 3;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_WEB_COOKIES = 4;
  public static final int ERROR_FUNCTIONALITY_NOT_SUPPORTED_WIFI_DIRECT = 5;
  // LocationSensor errors
  public static final int ERROR_LOCATION_SENSOR_LATITUDE_NOT_FOUND = 101;
  public static final int ERROR_LOCATION_SENSOR_LONGITUDE_NOT_FOUND = 102;
  // Camera errors
  public static final int ERROR_CAMERA_NO_IMAGE_RETURNED = 201;
  // Twitter errors
  public static final int ERROR_TWITTER_UNSUPPORTED_LOGIN_FUNCTION = 301;
  public static final int ERROR_TWITTER_BLANK_CONSUMER_KEY_OR_SECRET = 302;
  public static final int ERROR_TWITTER_EXCEPTION = 303;
  public static final int ERROR_TWITTER_UNABLE_TO_GET_ACCESS_TOKEN = 304;
  public static final int ERROR_TWITTER_AUTHORIZATION_FAILED = 305;
  public static final int ERROR_TWITTER_SET_STATUS_FAILED = 306;
  public static final int ERROR_TWITTER_REQUEST_MENTIONS_FAILED = 307;
  public static final int ERROR_TWITTER_REQUEST_FOLLOWERS_FAILED = 308;
  public static final int ERROR_TWITTER_REQUEST_DIRECT_MESSAGES_FAILED = 309;
  public static final int ERROR_TWITTER_DIRECT_MESSAGE_FAILED = 310;
  public static final int ERROR_TWITTER_FOLLOW_FAILED = 311;
  public static final int ERROR_TWITTER_STOP_FOLLOWING_FAILED = 312;
  public static final int ERROR_TWITTER_REQUEST_FRIEND_TIMELINE_FAILED = 313;
  public static final int ERROR_TWITTER_SEARCH_FAILED = 314;
  public static final int ERROR_TWITTER_INVALID_IMAGE_PATH = 315;
  // LegoMindstormsNXT errors
  public static final int ERROR_NXT_BLUETOOTH_NOT_SET = 401;
  public static final int ERROR_NXT_NOT_CONNECTED_TO_ROBOT = 402;
  public static final int ERROR_NXT_INVALID_RETURN_PACKAGE = 403;
  public static final int ERROR_NXT_ERROR_CODE_RECEIVED = 404;
  public static final int ERROR_NXT_INVALID_PROGRAM_NAME = 405;
  public static final int ERROR_NXT_INVALID_FILE_NAME = 406;
  public static final int ERROR_NXT_INVALID_MOTOR_PORT = 407;
  public static final int ERROR_NXT_INVALID_SENSOR_PORT = 408;
  public static final int ERROR_NXT_INVALID_MAILBOX = 409;
  public static final int ERROR_NXT_MESSAGE_TOO_LONG = 410;
  public static final int ERROR_NXT_DATA_TOO_LARGE = 411;
  public static final int ERROR_NXT_COULD_NOT_DECODE_ELEMENT = 412;
  public static final int ERROR_NXT_COULD_NOT_FIT_ELEMENT_IN_BYTE = 413;
  public static final int ERROR_NXT_INVALID_SOURCE_ARGUMENT = 414;
  public static final int ERROR_NXT_INVALID_DESTINATION_ARGUMENT = 415;
  public static final int ERROR_NXT_UNABLE_TO_DOWNLOAD_FILE = 416;
  public static final int ERROR_NXT_CANNOT_DETECT_COLOR = 417;
  public static final int ERROR_NXT_CANNOT_DETECT_LIGHT = 418;
  public static final int ERROR_NXT_INVALID_GENERATE_COLOR = 419;
  // Bluetooth errors
  public static final int ERROR_BLUETOOTH_NOT_AVAILABLE = 501;
  public static final int ERROR_BLUETOOTH_NOT_ENABLED = 502;
  public static final int ERROR_BLUETOOTH_INVALID_ADDRESS = 503;
  public static final int ERROR_BLUETOOTH_NOT_PAIRED_DEVICE = 504;
  public static final int ERROR_BLUETOOTH_NOT_REQUIRED_CLASS_OF_DEVICE = 505;
  public static final int ERROR_BLUETOOTH_INVALID_UUID = 506;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_CONNECT = 507;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_LISTEN = 508;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_ACCEPT = 509;
  public static final int ERROR_BLUETOOTH_COULD_NOT_DECODE = 510;
  public static final int ERROR_BLUETOOTH_COULD_NOT_FIT_NUMBER_IN_BYTE = 511;
  public static final int ERROR_BLUETOOTH_COULD_NOT_FIT_NUMBER_IN_BYTES = 512;
  public static final int ERROR_BLUETOOTH_COULD_NOT_DECODE_ELEMENT = 513;
  public static final int ERROR_BLUETOOTH_COULD_NOT_FIT_ELEMENT_IN_BYTE = 514;
  public static final int ERROR_BLUETOOTH_NOT_CONNECTED_TO_DEVICE = 515;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_WRITE = 516;
  public static final int ERROR_BLUETOOTH_UNABLE_TO_READ = 517;
  public static final int ERROR_BLUETOOTH_END_OF_STREAM = 518;
  public static final int ERROR_BLUETOOTH_UNSUPPORTED_ENCODING = 519;
  // ActivityStarter errors
  public static final int ERROR_ACTIVITY_STARTER_NO_CORRESPONDING_ACTIVITY = 601;
  // Media errors
  public static final int ERROR_UNABLE_TO_LOAD_MEDIA = 701;
  public static final int ERROR_UNABLE_TO_PREPARE_MEDIA = 702;
  public static final int ERROR_UNABLE_TO_PLAY_MEDIA = 703;
  public static final int ERROR_MEDIA_EXTERNAL_STORAGE_READONLY = 704;
  public static final int ERROR_MEDIA_EXTERNAL_STORAGE_NOT_AVAILABLE = 705;
  public static final int ERROR_MEDIA_IMAGE_FILE_FORMAT = 706;
  public static final int ERROR_MEDIA_CANNOT_OPEN = 707;
  public static final int ERROR_MEDIA_FILE_ERROR = 708;
  public static final int ERROR_UNABLE_TO_FOCUS_MEDIA = 709;
  public static final int ERROR_SOUND_NOT_READY = 710;
  public static final int ERROR_OUT_OF_MEMORY_LOADING_MEDIA = 711;
  // SoundRecorder errors
  public static final int ERROR_SOUND_RECORDER = 801;
  public static final int ERROR_SOUND_RECORDER_CANNOT_CREATE = 802;
  // Form errors
  public static final int ERROR_INVALID_SCREEN_ORIENTATION = 901;
  public static final int ERROR_SCREEN_NOT_FOUND = 902;
  public static final int ERROR_SCREEN_BAD_VALUE_RECEIVED = 903;
  public static final int ERROR_SCREEN_BAD_VALUE_FOR_SENDING = 904;
  public static final int ERROR_SCREEN_INVALID_ANIMATION = 905;
  public static final int ERROR_NO_FOCUSABLE_VIEW_FOUND = 906;
  // Canvas errors
  public static final int ERROR_CANVAS_BITMAP_ERROR = 1001;
  public static final int ERROR_CANVAS_WIDTH_ERROR = 1002;
  public static final int ERROR_CANVAS_HEIGHT_ERROR = 1003;
  // Web errors
  public static final int ERROR_WEB_UNABLE_TO_GET = 1101;
  public static final int ERROR_WEB_UNSUPPORTED_ENCODING = 1102;
  public static final int ERROR_WEB_UNABLE_TO_POST_OR_PUT = 1103;
  public static final int ERROR_WEB_UNABLE_TO_POST_OR_PUT_FILE = 1104;
  public static final int ERROR_WEB_JSON_TEXT_DECODE_FAILED = 1105;
  public static final int ERROR_WEB_HTML_TEXT_DECODE_FAILED = 1106;
  // There is a gap here because two ContactPicker errors below use the numbers 1107 and 1108.
  public static final int ERROR_WEB_MALFORMED_URL = 1109;
  public static final int ERROR_WEB_REQUEST_HEADER_NOT_LIST = 1110;
  public static final int ERROR_WEB_REQUEST_HEADER_NOT_TWO_ELEMENTS = 1111;
  public static final int ERROR_WEB_BUILD_REQUEST_DATA_NOT_LIST = 1112;
  public static final int ERROR_WEB_BUILD_REQUEST_DATA_NOT_TWO_ELEMENTS = 1113;
  public static final int ERROR_WEB_UNABLE_TO_DELETE = 1114;
  public static final int ERROR_WEB_XML_TEXT_DECODE_FAILED = 1115;
  // Contact picker (and PhoneNumberPicker) errors
  public static final int ERROR_PHONE_UNSUPPORTED_CONTACT_PICKER = 1107;
  public static final int ERROR_PHONE_UNSUPPORTED_SEARCH_IN_CONTACT_PICKING = 1108;
  // Camcorder errors
  public static final int ERROR_CAMCORDER_NO_CLIP_RETURNED = 1201;
  // VideoPlayer errors
  public static final int ERROR_VIDEOPLAYER_FULLSCREEN_UNAVAILBLE = 1301;
  public static final int ERROR_VIDEOPLAYER_FULLSCREEN_CANT_EXIT = 1302;
  public static final int ERROR_VIDEOPLAYER_FULLSCREEN_UNSUPPORTED = 1303;
  // Arrangement errors
  public static final int ERROR_BAD_VALUE_FOR_HORIZONTAL_ALIGNMENT = 1401;
  public static final int ERROR_BAD_VALUE_FOR_VERTICAL_ALIGNMENT = 1402;
  // BarcodeScanner errors
  public static final int ERROR_NO_SCANNER_FOUND = 1501;
  // ImagePicker errors
  public static final int ERROR_CANNOT_SAVE_IMAGE = 1601;
  public static final int ERROR_CANNOT_COPY_MEDIA = 1602;

  // Texting errors
  public static final int ERROR_BAD_VALUE_FOR_TEXT_RECEIVING = 1701;

  // Repl Communication Errors
  public static final int ERROR_REPL_SECURITY_ERROR = 1801;
  // AccelerometerSensor Errors
  public static final int ERROR_BAD_VALUE_FOR_ACCELEROMETER_SENSITIVITY = 1901;

  //Sharing Errors
  public static final int ERROR_FILE_NOT_FOUND_FOR_SHARING = 2001;

  // File errors
  public static final int ERROR_CANNOT_FIND_FILE = 2101;
  public static final int ERROR_CANNOT_READ_FILE = 2102;
  public static final int ERROR_CANNOT_CREATE_FILE = 2103;
  public static final int ERROR_CANNOT_WRITE_TO_FILE = 2104;
  public static final int ERROR_CANNOT_DELETE_ASSET = 2105;
  public static final int ERROR_CANNOT_WRITE_ASSET = 2106;

  // Yandex.Translate errors
  public static final int ERROR_TRANSLATE_NO_KEY_FOUND = 2201;
  public static final int ERROR_TRANSLATE_SERVICE_NOT_AVAILABLE = 2202;
  public static final int ERROR_TRANSLATE_JSON_RESPONSE = 2203;

  // TimePicker errors
  public static final int ERROR_ILLEGAL_HOUR = 2301;
  public static final int ERROR_ILLEGAL_MINUTE = 2302;

  // DatePicker errors
  public static final int ERROR_ILLEGAL_DATE = 2401;

  // WebViewer errors
  public static final int ERROR_WEBVIEW_SSL_ERROR = 2501;

  //FusiontablesControl errors
  public static final int FUSION_TABLES_QUERY_ERROR = 2601;

  //TextToSpeech errors
  public static final int ERROR_TTS_NOT_READY = 2701;

  // AndroidViewComponent errors
  public static final int ERROR_BAD_PERCENT = 2801;

  // 2901-2999 are reserved for FIRST Tech Challenge.

  // Image errors
  public static final int ERROR_IMAGE_CANNOT_ROTATE = 3001;

--
Ok, so the kind of errors I want to store information about (programming bugs like the one on my second post) don't have an accesible event from AppInventor interface. 

Thank you Taifun for the info.

--

Share a image


I'm having trouble with sharing images...my app has an image for each day of the month (The image already contains a sentence). But when I try to share the image, the application does not recognize. So I'm having to type (manually) the sentences to share.

But I'd like to share the images...

--
this snippet might help

How to take a picture or pick an image and share it

in case not, 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.

--
Thanks for the answer, but isn't still running. There's a print of my blocks. When I click the "button1" on the phone, this message appear: "Error 2001: The File file://15.jgp could not be found on your device."

But the image is appearing in the app.


--
you can't share an image stored as assets inside your app
the image must be stored on the sdcard and you have to use the full path to the image starting with file:///mnt/sdcard

--
Excuse ignorance, but how do I do to save the sd?

--
One way to do that is to set the picture as a Canvas BackgroundImage.
Then use the Canvas SaveAs block to save the image to the sdcard.
The added benefit of this is while it is the Canvas BackgroundImage, you can use the DrawText block to type a message on the photo before saving it.
Then you can share it from the sdcard.

--
I'm trying what they said on this topic: 
How to to display an image referring to a file name on the SD card?

But isn't working... :/

Do i need to install the application on the smartphone to test, or can I use the AI?

I will try this Canvas SaveAs To.

--
Set the image as the canvas BackgroundImage, then do this
--
Error:
"width and heigh must be >0"

--
Owwww! Worked!!

II had put the canvas as not visible. I fixed this and worked!!

--

Bug: Sharing component used together with the Image Picker


The sharing component works nice together with the camera component as also demonstrated by Jos in his video here https://plus.google.com/114710406005313398910/posts/BEkM1ZwbF9r

However if I use the image picker component to pick an image and try to share it via Gmail, I can't see the image as attachment (see screenshot) and after pressing send in Gmail, Gmail force closes.
It's also not possible to use Gmail anymore, it always force closes from now on. I had to delete the data of the Gmail app completely and then it worked again.
A Twitter test worked fine. For Google+ the text was posted without image, see also here https://plus.google.com/117623982903805917359/posts/671xtvFPLXf.
I used a Nexus 5 device for the test.
example project attached.


--
update: I now tested with a Samsung Galaxy Tab 10.1N running Android 3.2: Gmail does not force close, but the receiver of the email will not get the attachment

--
I also have few big problems with sharing component:
Using Nexus 5 - Android 4.4.2
1 - Gmail bug problem when trying to send image from imagepicker
2 - Sharing text shows up wrong dimension application picker, see picture below:
Sharing image works fine (app picker opens up with correct dimension)
I also experience all other problems mentioned by TaiFun,
i hope the team can fix those annoying bugs soon.

--
Sebastian found the problem, see here
we have to add file:// in front of the path!
--
Same to me, sharing dialog too big. I can only see one or two app icons. Fix it!!!

--
 What would you like us to fix?  Can you explain?  Exactly what dialog are you referring to?

--
In some devices the sharing dialog showing the available apps is huge. Victor is looking into it.
--

Sharing a sound (mp3 file) in ai2 app inventor


How can I share a sound music (mp3/wav file) with whatsapp or email, social programs?  

For example, I have a button that when clicked plays a mp3 sound. I want to share this mp3 sound with other apps like whatsapp, skype, gmail....  

Can you help me please ???

I attached an example that I did, but it´s not working... What´s wrong? 
--
Your blocks look OK.

When you execute share, the phone should present you with a choice of programs to use for sharing.   The list will depend on
what's on your phone, but Gmail should definitely be one of them.

What goes wrong?

--
probably this helps?
When I handle the button appears the message: error 2001: The File file://done.wav could not be found on your device.
Do I have to specify some path??
--
Do I have to specify some path??
in case your file is not in the root directory: yes
you might want to provide a screenshot of your relevant blocks

--
But, which path is the root directory?
I just uploaded the wav file when I add the sound player.
Attached the properties and the blocks. 


--
as far as I know, you can't share a file uploaded as asset into App Inventor
the file must be available on the device, for example if you store the file in the root directory, it would be the following path: file:///mnt/sdcard/done.wav
note: there are 3 slashes

--
Hello, junio.. I would like to do the samw, were you able to fix ????

I have a soundboard (already in playstore look for Fala Galvao) and I would like to create an option to share the sounds that is possible to play there.

--

Where have all the files Gone - Part II (fetching files withing .apk package)


Jose or anyone, I meant this as a follow-up to my Where Have all the Files Gone thread, but it looks like it got closed (Completed).   

I watched your video about sharing files, and wanted to use a button to share a file, such that a filemanager or whatever would open it.   Basically

⦁ When BUTTON1 Click.
⦁  Call SHARING1 .Sharefile
   File =  Text "flename.extention"    (or get VARIABLE (with filename in it))   

But when I click the button, it says it cannot find my file, which I uploaded into Designer and built the .apk with that in mind. 

So, either the .apk does not build with my filename.extention, or it is called something different or in a different path ("asset") ?   Can you help me on this aspect ?    (It is not an image nor a sound file, and I verifiied my filename is correct in the code.  And in this case, it is NOT a file I want to read/write from/to, just a file that need opening or sharing or accessing by another application like a filemanager.)   

--
PS:  I found another thread up here on the forum with a related question, through Error 2001 about file not found.     I hope the answer in that thread is not true.   There are many reasons for allowing an .apk file program to access files uploaded through the .apk file.       See here: Sharing a sound (mp3 file) in ai2 app inventor

If the ultimit answer is that one cannot share files stored in the .apk package (which were uploaded to Designer before building the .apk) then my next question is, is it possible to have the .apk-provided program open and save the files to file://somewhere/...   meaning opening it as a binary and saving it to actual file location file://...    ?   

--  
the Sharing component can only share files stored on the sdcard of the device, but not from the assets of the app

for images, you could store temporarily on the sdcard, you can use a canvas for that 
then send the image from the location on the sdcard

PS: you still can add something to a completed thread, this only means, the question is answered... just try it...
--
 Can you help me on this aspect ?    (It is not an image nor a sound file
for other file types, an alternative could be to download these files on first run of the app from the internet


--
Thank you Taifun.  It does look like webprefetch may be the way to go.    

--