ActivityStarter

Last Updated On 2021-07-16

Version 6MinSDK 7Tutorial Video

A component that can launch an activity using the StartActivity method.

Activities that can be launched include:

  • starting other App Inventor for Android apps
  • starting the camera application
  • performing web search
  • opening a browser to a specified web page
  • opening the map application to a specified location
You can also launch activities that return text data. See the documentation on using the Activity Starter for examples.


Properties

You can set the below properties in the UI part of the builder.

  • Action - it's a string value which is set to blank by default.
  • ActivityClass - it's a string value which is set to blank by default.
  • ActivityPackage - it's a string value which is set to blank by default.
  • DataType - it's a string value which is set to blank by default.
  • DataUri - it's a string value which is set to blank by default.
  • ExtraKey - it's a string value which is set to blank by default.
  • ExtraValue - it's a string value which is set to blank by default.
  • ResultName - it's a string value which is set to blank by default.

Block Properties

You can set the below blocks properties in the blocks section of the builder.

Action

Returns the action that will be used to start the activity.


ActivityClass

Returns the class part of the specific component that will be started.


ActivityPackage

Returns the package part of the specific component that will be started.


DataType

Returns the MIME type to pass to the activity.


DataUri

Returns the data URI that will be used to start the activity.


ExtraKey

Returns the extra key that will be passed to the activity. DEPRECATED: New code should use Extras property instead.


ExtraValue

Returns the extra value that will be passed to the activity. DEPRECATED: New code should use Extras property instead.


Extras

Specifies the list of key-value pairs that will be passed as extra data to the activity.


Result

Returns the result from the activity.


ResultName

Returns the name that will be used to retrieve a result from the activity.


ResultType

Returns the MIME type from the activity.


ResultUri

Returns the URI from the activity.



Methods

You can set the below method blocks in the blocks section of the builder.

ResolveActivity

Returns the name of the activity that corresponds to this ActivityStarter, or an empty string if no corresponding activity can be found.

StartActivity

Start the activity corresponding to this ActivityStarter.


Events

You can set the below event blocks in the blocks section of the builder.

ActivityCanceled

Event raised if this ActivityStarter returns because the activity was canceled.

ActivityError

The ActivityError event is no longer used. Please use the Screen.ErrorOccurred event instead.

AfterActivity

Event raised after this ActivityStarter returns.