public abstract class ShareService

  1. Object
  2. Command
  3. ShareService

ImplementsActionListener<ActionEvent>

Known subtypesEmailShare, FacebookShare, SMSShare

This is an abstract sharing service.

Constructors

public ShareService(String name, Image icon)Constructor with the service name and icon

Methods

public void actionPerformed(ActionEvent evt)This method is called when the soft button/Menu item is clicked
public abstract void share(String text)This is the sharing method which should be implemented by the service.
public void share(String text, String image, String imageMimeType)This is the image sharing method which should be implemented by the service, if the service returned true on the canShareImage() method Notice not all services are able to share text and image together, in this case the image sharing will b…
public abstract boolean canShareImage()The implementing service needs to declare if it is capable to share an image
public void setMessage(String message)Sets the message to share, this is done by the ShareButton and shouldn’t be used by the developers
public void setImage(String image, String mime)Sets the image to share, this is done by the ShareButton and shouldn’t be used by the developers
public void setOriginalForm(Form original)Sets the Original Form (this is the Form of the share button)
public Form getOriginal()Gets the original Form
public void finish()Once the share service has finished sharing it should call the finish method
public void setShareResultListener(ShareResultListener listener)Registers a listener to be notified once when the share completes.
public ShareResultListener getShareResultListener()Returns the registered result listener (may be null).
protected void deliverResult(ShareResult result)Delivers a ShareResult to the registered listener exactly once.

Inherited fields

Inherited methods

Constructor details

ShareService

public ShareService(String name, Image icon)
Constructor with the service name and icon

Parameters

name String
the service name
icon Image
the service icon

Method details

actionPerformed

public void actionPerformed(ActionEvent evt)
This method is called when the soft button/Menu item is clicked

Parameters

evt ActionEvent
the Event Object

share

public abstract void share(String text)
This is the sharing method which should be implemented by the service.

Parameters

text String
text to share

share

public void share(String text, String image, String imageMimeType)
This is the image sharing method which should be implemented by the service, if the service returned true on the canShareImage() method Notice not all services are able to share text and image together, in this case the image sharing will be preferred by these services

Parameters

text String
text to share
image String
image to share
imageMimeType String
Not documented.

canShareImage

public abstract boolean canShareImage()
The implementing service needs to declare if it is capable to share an image

Returns

true if the service can share images

setMessage

public void setMessage(String message)
Sets the message to share, this is done by the ShareButton and shouldn’t be used by the developers

setImage

public void setImage(String image, String mime)
Sets the image to share, this is done by the ShareButton and shouldn’t be used by the developers

Parameters

image String
the file path to the image
mime String
the image mime type e.g. image/png, image/jpeg

setOriginalForm

public void setOriginalForm(Form original)
Sets the Original Form (this is the Form of the share button)

getOriginal

public Form getOriginal()
Gets the original Form

finish

public void finish()
Once the share service has finished sharing it should call the finish method

setShareResultListener

public void setShareResultListener(ShareResultListener listener)

Registers a listener to be notified once when the share completes.

Set by ShareButton before the service is invoked. Subclasses normally do not call this directly.

getShareResultListener

public ShareResultListener getShareResultListener()
Returns the registered result listener (may be null).

deliverResult

protected void deliverResult(ShareResult result)

Delivers a ShareResult to the registered listener exactly once.

Subclasses can call this to report a DISMISSED (user cancelled) or FAILED outcome. finish already reports a default SHARED_TO(commandName) if no explicit result was delivered.