Changes

Jump to navigation Jump to search
Line 2: Line 2:     
= Class: Activity =
 
= Class: Activity =
 +
=== What are activity id's? How do I obtain the activity id for an instance of my activity? ===
 +
The activity id is sort of like the unix process id (PID). However, unlike PIDs it is only different for each new instance (with create_jobject = True set) and stays the same every time a user resumes an activity. This is also the identity of your Activity to other XOs for use when sharing.
 +
 +
You can use the get_id() method in the activity class to get the activity id for your activity. Since most activities should inherit from the Activity class, you can actually just get a handle on the top level object for your activity and use that to call get_id.
 +
 +
  ### TOOLBAREXAMPLE IS AN ACTIVITY THAT SUBCLASSES SUGAR'S ACTIVITY CLASS
 +
  class ToolbarExample(activity.Activity):
 +
      def __init__(self, handle):
 +
          activity.Activity.__init__(self, handle)
 +
          ...
 +
          #store the activity id for this variable in the variable my_id
 +
          my_id = self.get_id()
 +
          ...
 +
 
=== How do I create a new activity that is derived from the base Activity class? ===
 
=== How do I create a new activity that is derived from the base Activity class? ===
  
Anonymous user

Navigation menu