Share any file from External Storage in sketchware

1) Create a new sketchware project.

2) Add a Button with id button1.


3) Add a FilePicker with name g and with file type */*.

4) In button1 onClick event do as below:-

5) Add a string variable with name myFilePath :-


6) In on FilePicked event to get file path add a listString str.
Set String myFilePath to get at 0 at List String : filePath
Then Do as below:-

7) Code used in the ASD block is:-

Intent intentShareFile = new Intent(Intent.ACTION_SEND);
intentShareFile.setType("application/*");
intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+myFilePath)); startActivity(Intent.createChooser(intentShareFile, "Share File"));

That's all. Save and run project...

Comments

Popular posts from this blog

How to make a website in 2019 with no investment.

Make a layout with rounded corners in sketchware

Add menu in actionbar in Sketchware