Description

The CurrentActivity property returns the name of the activity that is currently active on the device.

Declaration

AndroidProcessObj.CurrentActivity

Read-Only Property String
AndroidProcessObj An expression, variable or parameter that specifies a reference to an AndroidProcess object

Applies To

The property is applied to the following object:

Property Value

A string containing the name of the current activity.

Example

The sample code below posts the name of the current activity to the test log:

JavaScript, JScript

Log.Message("The " + Mobile.Device("VirtualBox").Process("com.example.orders").CurrentActivity + " activity is currently active.");

Python

Log.Message("The " + VarToStr(Mobile.Device("VirtualBox").Process("com.example.orders").CurrentActivity) + " activity is currently active.")

VBScript

Log.Message("The " & Mobile.Device("VirtualBox").Process("com.example.orders").CurrentActivity & " activity is currently active.")

DelphiScript

Log.Message('The ' + VarToStr(Mobile.Device('VirtualBox').Process('com.example.orders').CurrentActivity) + ' activity is currently active.');

C++Script, C#Script

Log["Message"]("The " + Mobile["Device"]("VirtualBox")["Process"]("com.example.orders")["CurrentActivity"] + " activity is currently active.");

See Also

AndroidProcess Object
WaitActivity Method
Testing Android Applications (Legacy)

Highlight search results