public class

CarouselActivity

extends ActivityGroup
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ android.app.ActivityGroup
             ↳ com.htc.widget.CarouselActivity

This class is deprecated.
Not supported class

Class Overview

An activity that contains and runs multiple embedded activities or views. For having a tab with edit mode, the things you must done are as the following:

  • Please have your host activity extend CarouselActivity. When you implement the constructor of your activity, a call to super() with the authority of your database which contains the information of every element of your tab as the parameter is required. Also, for supporting nested tabs, a group ID is required for your activity in its onCreate(). function. A change to the prototype of CarouselHost.addTab() is done for more elegant way of function call. Please refer to the following example for all the important notices mentioned above:
              public class DemoActivity extends CarouselActivity {
                  final static String AUTHORITY = "com.htc.app.MyProvider";
                  public DemoActivity() {
                      super(AUTHORITY);
                  }
                  
                  public void onCreate(Bundle savedInstanceState) {
                      this.setGId(1);
                      super.onCreate(savedInstanceState);
                      
                      //Do some settings and add your tab items
                       setContentView(R.layout.carousel_switch);
                       final CarouselHost mPanelHost = getTabHost();
                       
                        for(int i=0 ; i<1;i++){
                            mPanelHost.addTab("Artist", this
                            , R.string.artists_title
                            , R.drawable.common_icon_artist_rest
                            , R.drawable.common_icon_artist_on
                            , R.drawable.common_icon_overlay_artist
                            , (new Intent("com.htc.test.show11")));
                            mPanelHost.setCountVisibility(0+i*6, false);
                            mPanelHost.setCountText(0+i*6,new Integer(0+i*6).toString());
                            
                            ...
                       }
                      ...
                      
                  }
              }
        
  • Implement your own provider which extends CarouselProvider for saving information of each of your tab element. Sample code is as the following:
             public class MyProvider extends CarouselProvider {
                 final static String AUTHORITY = "com.borran.app.MyProvider";
                 public MyProvider(){
                     super();
                     setupCarousel(AUTHORITY);
                 }
             }
        
  • In your Manifest file, please add information for your provider. For example:
              
        
  • If you need to override onCreateDialog(int id), please do it as the following example code:
             protected Dialog onCreateDialog(int id) {
                 Dialog dialog = super.onCreateDialog(id);
                 if(dialog == null){
                     dialog = create your own dialog
                 }
             
                 return dialog;
             }
        

Summary

Constants
int FEATURE_CUSTOM_TITLE
int FEATURE_NO_EDITOR
int FEATURE_NO_TITLE
int NO_UPDATE_REQUIRED
int UPDATE_COUNT_TEXT
int UPDATE_COUNT_TEXT_VISIBLE
int UPDATE_TASK_NAME
[Expand]
Inherited Constants
From class android.app.Activity
From class android.content.Context
From interface android.content.ComponentCallbacks2
[Expand]
Inherited Fields
From class android.app.ActivityGroup
From class android.app.Activity
Public Constructors
CarouselActivity(String authority)
Constructor
Public Methods
void beginTransaction()
void endTransaction()
CarouselHost getCarouselHost()
Returns the CarouselHost the activity is using to host its tabs.
CarouselWidget getCarouselWidget()
Returns the CarouselWidget the activity is using to draw the actual tabs.
void onConfigurationChanged(Configuration newConfig)
void onContentChanged()
Updates the screen state (current list and other views) when the content changes.
void onCurrentTabChanged(String currentTab)
callback function when the current tab is changed
void onTabEndSliding(String endTag)
A callback function for knowing when the user ends the drag motion
void onTabStartSliding(String startTag)
A callback function for knowing when the user starts to drag the tab selector
final boolean requestCarouselFeature(int featureId)
Enables extended screen features.
final void setCarouselFeatureInt(int featureId, int value)
Sets the integer value for a feature.
final void setContentView(View view)
final void setContentView(int layoutResID)
void setContentView(View view, ViewGroup.LayoutParams params)
void setDefaultTab(int index)
Sets the default tab that is the first tab highlighted.
void setDefaultTab(String tag)
Sets the default tab that is the first tab highlighted.
void setGId(int gId)
When there are several carousels in your application, you need to assign each carousel to an unique id.
void setGId(String gId)
When there are several carousels in your application, you need to assign each carousel to an unique id.
Protected Methods
void enterEditMode()
void exitEditMode()
boolean isInEditMode()
void onChildTitleChanged(Activity childActivity, CharSequence title)
void onCreate(Bundle savedInstanceState)
void onDestroy()
void onPause()
void onRestoreInstanceState(Bundle state)
void onResume()
void onSaveInstanceState(Bundle outState)
void onStart()
[Expand]
Inherited Methods
From class android.app.ActivityGroup
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.KeyEvent.Callback
From interface android.view.LayoutInflater.Factory
From interface android.view.LayoutInflater.Factory2
From interface android.view.PenManager.PenCallback
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface android.view.Window.HtcCallback
From interface android.view.Window.HtcRotAnimEndCallback

Constants

public static final int FEATURE_CUSTOM_TITLE

Since: API Level 2.0

Constant Value: 4 (0x00000004)

public static final int FEATURE_NO_EDITOR

Since: API Level 2.0

Constant Value: 8 (0x00000008)

public static final int FEATURE_NO_TITLE

Since: API Level 2.0

Constant Value: 2 (0x00000002)

public static final int NO_UPDATE_REQUIRED

Since: API Level 2.0

Constant Value: 1008 (0x000003f0)

public static final int UPDATE_COUNT_TEXT

Since: API Level 2.0

Constant Value: 1003 (0x000003eb)

public static final int UPDATE_COUNT_TEXT_VISIBLE

Since: API Level 2.0

Constant Value: 1004 (0x000003ec)

public static final int UPDATE_TASK_NAME

Since: API Level 2.0

Constant Value: 1007 (0x000003ef)

Public Constructors

public CarouselActivity (String authority)

Since: API Level 2.0

Constructor

Parameters
authority The authority of your database which is used to maintain the information of every element of your tab

Public Methods

public void beginTransaction ()

Since: API Level 2.0

public void endTransaction ()

Since: API Level 2.0

public CarouselHost getCarouselHost ()

Since: API Level 2.0

Returns the CarouselHost the activity is using to host its tabs.

Returns

public CarouselWidget getCarouselWidget ()

Since: API Level 2.0

Returns the CarouselWidget the activity is using to draw the actual tabs.

Returns

public void onConfigurationChanged (Configuration newConfig)

Since: API Level

public void onContentChanged ()

Since: API Level

Updates the screen state (current list and other views) when the content changes.

public void onCurrentTabChanged (String currentTab)

Since: API Level 2.0

callback function when the current tab is changed

Parameters
currentTab The tag of the current tab

public void onTabEndSliding (String endTag)

Since: API Level 2.0

A callback function for knowing when the user ends the drag motion

Parameters
endTag The tag of the tab which the user end up dragging the tab indicator

public void onTabStartSliding (String startTag)

Since: API Level 2.0

A callback function for knowing when the user starts to drag the tab selector

Parameters
startTag The tag of tab which the users start the dragging

public final boolean requestCarouselFeature (int featureId)

Since: API Level 2.0

Enable extended screen features. This must be called before setContentView(). May be called as many times as desired as long as it is before setContentView(). If not called, no extended features will be available. You can not turn off a feature once it is requested. You canot use other title features with FEATURE_CUSTOM_TITLE.

Parameters
featureId The desired features, defined as constants by Window.
Returns
  • The features that are now set.

public final void setCarouselFeatureInt (int featureId, int value)

Since: API Level 2.0

Sets the integer value for a feature. The range of the value depends on the feature being set.

Parameters
featureId The desired feature to change. Features are constants defined by Carousel.
value The value for the feature. The interpretation of this value is feature-specific.

public final void setContentView (View view)

Since: API Level 2.0

public final void setContentView (int layoutResID)

Since: API Level 2.0

public void setContentView (View view, ViewGroup.LayoutParams params)

Since: API Level

public void setDefaultTab (int index)

Since: API Level 2.0

Sets the default tab that is the first tab highlighted.

Parameters
index The index of the default tab

public void setDefaultTab (String tag)

Since: API Level 2.0

Sets the default tab that is the first tab highlighted.

Parameters
tag The name of the default tab

public void setGId (int gId)

Since: API Level 2.0

When there are several carousels in your application, you need to assign each carousel to an unique id.

Parameters
gId Unique Id

public void setGId (String gId)

Since: API Level 2.0

When there are several carousels in your application, you need to assign each carousel to an unique id.

Parameters
gId Unique Id

Protected Methods

protected void enterEditMode ()

Since: API Level 2.0

protected void exitEditMode ()

Since: API Level 4.0

protected boolean isInEditMode ()

Since: API Level 4.0

protected void onChildTitleChanged (Activity childActivity, CharSequence title)

Since: API Level

protected void onCreate (Bundle savedInstanceState)

Since: API Level

protected void onDestroy ()

Since: API Level

protected void onPause ()

Since: API Level

protected void onRestoreInstanceState (Bundle state)

Since: API Level

protected void onResume ()

Since: API Level

protected void onSaveInstanceState (Bundle outState)

Since: API Level

protected void onStart ()

Since: API Level