Kamis, 11 Mei 2023

How to add a common share button in Sketchware?


Sharing text contents or URLs from a Sketchware App is possible using intent, but the data can only be shared using individual urls to emails, facebook, twitter, and other sites which provide a sharing option, individually. But in order to implement a common share button for sharing content, some code is to be added in the project using add source directly block.

Follow the steps below to add a share button in Sketchware App.

1. Suppose you want to share the contents of field Edittext1 as title and of field Edittext2​ as main content. For sharing the contents, first insert a button or an imageview with share icon.

2. In LOGIC area, in the onClick event for button, which is to be used as share button, add two string variables a and b.

3. Set string variable a to contents of Edittext1 field, and variable b to contents of Edittext2 field.
4. Add the following code in add source directly block:
Intent i = new Intent(android.content.Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(android.content.Intent.EXTRA_SUBJECT, a); i.putExtra(android.content.Intent.EXTRA_TEXT, b); startActivity(Intent.createChooser(i,"Share using"));

Note that in the code, i is name of intent, a is name of a string variable, and b is also name of a string variable.

4. Save and run the project.

Here is a video of the same process.

Share:

0 komentar:

Posting Komentar

Alam terbuka mengasyikkan di Destinasi impian

Jasa Pembuatan Website Archives - Legenda Web

loading...

Archive

Cari Blog Ini

Diberdayakan oleh Blogger.

Mengenai Saya

Foto saya
Saya memiliki Jasa Pembuatan Website Terpercaya
www.legendaweb.com

Pernah mengerjakan seo untuk Agen Travel door to door ecopremieretransindo.com dan Agen Travel Jakarta Jogja jakjogtrans.com

Juga memegang SEO Biro jasa paspor

Selain Itu, kerjasama dengan Sewa Mobil Bali Mai Bali Trans dan Industri pariwisata trip Bali dari beautrip.id

Labels

Admob ads in Sketchware Admob Ads in Sketchware App admob ads using AIDE Admob banner ads using AIDE Admob interstitial Ads Android app Android change status bar color animation in Sketchware background music Change color of checkbox in Sketchware change color of Seekbar change color of Switch button change status bar color code for moving image with finger in android code Injection create and share text file in Sketchware create text file in Sketchware Custom listview in android Custom ListView in Sketchware CustomView in Sketchware Dictionary Android App Dictionary Android project Dictionary App Dictionary App in Sketchware drag image enable download from Sketchware enable download in webview enable download without code Injection Enable image upload enable upload from webview enable upload from webview in android enable upload in Sketchware enable upload in webview​ using AIDE enable upload using AIDE gif image in Android App gif image in webview how to use ListView in Sketchware how to use Spinner image zoom Integrate Admob Ads in Sketchware Intent large paragraphs in Sketchware larger texts in Edittext. limit input text length load image in webview make image fit screen make scrollbar invisible media player move image with finger notification icon in Android notification in Android Notifications in Sketchware open other apps retrieve APK file retrieve source code share button share button in Android App share button in Sketchware App Share text file Sketchware sound on off sound play pause soundpool Soundpool for Multiple sounds Sounds in Android App stopwatch Android App Stopwatch App string list timer use of list