android官方API之AppCompatActivity

来源:https://developer.android.com/reference/android/support/v7/app/AppCompatActivity

AppCompatActivity

public class AppCompatActivity 
extends FragmentActivity implements AppCompatCallbackTaskStackBuilder.SupportParentable,ActionBarDrawerToggle.DelegateProvider

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ android.support.v4.app.FragmentActivity
             ↳ android.support.v7.app.AppCompatActivity

Base class for activities that use the support library action bar features.

You can add an ActionBar to your activity when running on API level 7 or higher by extending this class for your activity and setting the activity theme to Theme.AppCompat or a similar theme.

Developer Guides

For information about how to use the action bar, including how to add action items, navigation modes and more, read the Action Bar API guide.

Summary

Inherited constants

From class android.app.Activity
int DEFAULT_KEYS_DIALER
int DEFAULT_KEYS_DISABLE
int DEFAULT_KEYS_SEARCH_GLOBAL
int DEFAULT_KEYS_SEARCH_LOCAL
int DEFAULT_KEYS_SHORTCUT
int RESULT_CANCELED
int RESULT_FIRST_USER
int RESULT_OK
From class android.content.Context
String ACCESSIBILITY_SERVICE
String ACCOUNT_SERVICE
String ACTIVITY_SERVICE
String ALARM_SERVICE
String APPWIDGET_SERVICE
String APP_OPS_SERVICE
String AUDIO_SERVICE
String BATTERY_SERVICE
int BIND_ABOVE_CLIENT
int BIND_ADJUST_WITH_ACTIVITY
int BIND_ALLOW_OOM_MANAGEMENT
int BIND_AUTO_CREATE
int BIND_DEBUG_UNBIND
int BIND_EXTERNAL_SERVICE
int BIND_IMPORTANT
int BIND_NOT_FOREGROUND
int BIND_WAIVE_PRIORITY
String BLUETOOTH_SERVICE
String CAMERA_SERVICE
String CAPTIONING_SERVICE
String CARRIER_CONFIG_SERVICE
String CLIPBOARD_SERVICE
String COMPANION_DEVICE_SERVICE
String CONNECTIVITY_SERVICE
String CONSUMER_IR_SERVICE
int CONTEXT_IGNORE_SECURITY
int CONTEXT_INCLUDE_CODE
int CONTEXT_RESTRICTED
String CROSS_PROFILE_APPS_SERVICE
String DEVICE_POLICY_SERVICE
String DISPLAY_SERVICE
String DOWNLOAD_SERVICE
String DROPBOX_SERVICE
String FINGERPRINT_SERVICE
String HARDWARE_PROPERTIES_SERVICE
String INPUT_METHOD_SERVICE
String INPUT_SERVICE
String IPSEC_SERVICE
String JOB_SCHEDULER_SERVICE
String KEYGUARD_SERVICE
String LAUNCHER_APPS_SERVICE
String LAYOUT_INFLATER_SERVICE
String LOCATION_SERVICE
String MEDIA_PROJECTION_SERVICE
String MEDIA_ROUTER_SERVICE
String MEDIA_SESSION_SERVICE
String MIDI_SERVICE
int MODE_APPEND
int MODE_ENABLE_WRITE_AHEAD_LOGGING
int MODE_MULTI_PROCESS
int MODE_NO_LOCALIZED_COLLATORS
int MODE_PRIVATE
int MODE_WORLD_READABLE
int MODE_WORLD_WRITEABLE
String NETWORK_STATS_SERVICE
String NFC_SERVICE
String NOTIFICATION_SERVICE
String NSD_SERVICE
String POWER_SERVICE
String PRINT_SERVICE
int RECEIVER_VISIBLE_TO_INSTANT_APPS
String RESTRICTIONS_SERVICE
String SEARCH_SERVICE
String SENSOR_SERVICE
String SHORTCUT_SERVICE
String STORAGE_SERVICE
String STORAGE_STATS_SERVICE
String SYSTEM_HEALTH_SERVICE
String TELECOM_SERVICE
String TELEPHONY_SERVICE
String TELEPHONY_SUBSCRIPTION_SERVICE
String TEXT_CLASSIFICATION_SERVICE
String TEXT_SERVICES_MANAGER_SERVICE
String TV_INPUT_SERVICE
String UI_MODE_SERVICE
String USAGE_STATS_SERVICE
String USB_SERVICE
String USER_SERVICE
String VIBRATOR_SERVICE
String WALLPAPER_SERVICE
String WIFI_AWARE_SERVICE
String WIFI_P2P_SERVICE
String WIFI_RTT_RANGING_SERVICE
String WIFI_SERVICE
String WINDOW_SERVICE
From interface android.content.ComponentCallbacks2
int TRIM_MEMORY_BACKGROUND
int TRIM_MEMORY_COMPLETE
int TRIM_MEMORY_MODERATE
int TRIM_MEMORY_RUNNING_CRITICAL
int TRIM_MEMORY_RUNNING_LOW
int TRIM_MEMORY_RUNNING_MODERATE
int TRIM_MEMORY_UI_HIDDEN

Inherited fields

From class android.app.Activity
protected static final int[] FOCUSED_STATE_SET

Public constructors

AppCompatActivity()

Public methods

void addContentView(View view, ViewGroup.LayoutParams params)
void closeOptionsMenu()
boolean dispatchKeyEvent(KeyEvent event)
<T extends View> T findViewById(int id)
AppCompatDelegate getDelegate()
ActionBarDrawerToggle.Delegate getDrawerToggleDelegate()
MenuInflater getMenuInflater()
Resources getResources()
ActionBar getSupportActionBar()

Support library version of getActionBar().

Intent getSupportParentActivityIntent()

Obtain an Intent that will launch an explicit target activity specified by sourceActivity's PARENT_ACTIVITY <meta-data> element in the application's manifest.

void invalidateOptionsMenu()
void onConfigurationChanged(Configuration newConfig)

Dispatch configuration change to all fragments.

void onContentChanged()
void onCreateSupportNavigateUpTaskStack(TaskStackBuilder builder)

Support version of onCreateNavigateUpTaskStack(android.app.TaskStackBuilder).

boolean onKeyDown(int keyCode, KeyEvent event)
final boolean onMenuItemSelected(int featureId, MenuItem item)

Dispatch context and options menu to fragments.

boolean onMenuOpened(int featureId, Menu menu)

Please note: AppCompat uses its own feature id for the action bar:FEATURE_SUPPORT_ACTION_BAR.

void onPanelClosed(int featureId, Menu menu)

Call onOptionsMenuClosed() on fragments.

Please note: AppCompat uses its own feature id for the action bar:FEATURE_SUPPORT_ACTION_BAR.

void onPrepareSupportNavigateUpTaskStack(TaskStackBuilder builder)

Support version of onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder).

void onSupportActionModeFinished(ActionMode mode)

Notifies the activity that a support action mode has finished.

void onSupportActionModeStarted(ActionMode mode)

Notifies the Activity that a support action mode has been started.

void onSupportContentChanged()

This method was deprecated in API level 25.1.0. Use onContentChanged() instead.

boolean onSupportNavigateUp()

This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.

ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback)

Called when a support action mode is being started for this window.

void openOptionsMenu()
void setContentView(View view)
void setContentView(int layoutResID)
void setContentView(View view, ViewGroup.LayoutParams params)
void setSupportActionBar(Toolbar toolbar)

Set a Toolbar to act as the ActionBar for this Activity window.

void setSupportProgress(int progress)

This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat.

void setSupportProgressBarIndeterminate(boolean indeterminate)

This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat.

void setSupportProgressBarIndeterminateVisibility(boolean visible)

This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat.

void setSupportProgressBarVisibility(boolean visible)

This method was deprecated in API level 25.1.0. Progress bars are no longer provided in AppCompat.

void setTheme(int resid)
ActionMode startSupportActionMode(ActionMode.Callback callback)

Start an action mode.

void supportInvalidateOptionsMenu()

This method is deprecated. Call invalidateOptionsMenu() directly.

void supportNavigateUpTo(Intent upIntent)

Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process.

boolean supportRequestWindowFeature(int featureId)

Enable extended support library window features.

boolean supportShouldUpRecreateTask(Intent targetIntent)

Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent.

Protected methods

void onCreate(Bundle savedInstanceState)

Perform initialization of all fragments.

void onDestroy()

Destroy all fragments.

void onPostCreate(Bundle savedInstanceState)
void onPostResume()

Dispatch onResume() to fragments.

void onSaveInstanceState(Bundle outState)

Save all appropriate fragment state.

void onStart()

Dispatch onStart() to all fragments.

void onStop()

Dispatch onStop() to all fragments.

void onTitleChanged(CharSequence title, int color)

Inherited methods

From class android.support.v4.app.FragmentActivity
void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

Print the Activity's state into the given stream.

Object getLastCustomNonConfigurationInstance()

Return the value previously returned from onRetainCustomNonConfigurationInstance().

Lifecycle getLifecycle()

Returns the Lifecycle of the provider.

FragmentManager getSupportFragmentManager()

Return the FragmentManager for interacting with fragments associated with this activity.

LoaderManager getSupportLoaderManager()
ViewModelStore getViewModelStore()

Returns the ViewModelStore associated with this activity

void onActivityResult(int requestCode, int resultCode, Intent data)

Dispatch incoming result to the correct fragment.

void onAttachFragment(Fragment fragment)

Called when a fragment is attached to the activity.

void onBackPressed()

Take care of popping the fragment back stack or finishing the activity as appropriate.

void onConfigurationChanged(Configuration newConfig)

Dispatch configuration change to all fragments.

void onCreate(Bundle savedInstanceState)

Perform initialization of all fragments.

boolean onCreatePanelMenu(int featureId, Menu menu)

Dispatch to Fragment.onCreateOptionsMenu().

View onCreateView(View parent, String name, Context context, AttributeSetattrs)
View onCreateView(String name, Context context, AttributeSet attrs)
void onDestroy()

Destroy all fragments.

void onLowMemory()

Dispatch onLowMemory() to all fragments.

boolean onMenuItemSelected(int featureId, MenuItem item)

Dispatch context and options menu to fragments.

void onMultiWindowModeChanged(boolean isInMultiWindowMode)

Note: If you override this method you must call super.onMultiWindowModeChanged to correctly dispatch the event to support fragments attached to this activity.

void onNewIntent(Intent intent)

Handle onNewIntent() to inform the fragment manager that the state is not saved.

void onPanelClosed(int featureId, Menu menu)

Call onOptionsMenuClosed() on fragments.

void onPause()

Dispatch onPause() to fragments.

void onPictureInPictureModeChanged(boolean isInPictureInPictureMode)

Note: If you override this method you must call super.onPictureInPictureModeChangedto correctly dispatch the event to support fragments attached to this activity.

void onPostResume()

Dispatch onResume() to fragments.

boolean onPreparePanel(int featureId, View view, Menu menu)

Dispatch onPrepareOptionsMenu() to fragments.

void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)

Callback for the result from requesting permissions.

void onResume()

Dispatch onResume() to fragments.

void onResumeFragments()

This is the fragment-orientated version of onResume() that you can override to perform operations in the Activity at the same point where its fragments are resumed.

Object onRetainCustomNonConfigurationInstance()

Use this instead of onRetainNonConfigurationInstance().

final Object onRetainNonConfigurationInstance()

Retain all appropriate fragment state.

void onSaveInstanceState(Bundle outState)

Save all appropriate fragment state.

void onStart()

Dispatch onStart() to all fragments.

void onStateNotSaved()

Hook in to note that fragment state is no longer saved.

void onStop()

Dispatch onStop() to all fragments.

void setEnterSharedElementCallback(SharedElementCallback callback)

When makeSceneTransitionAnimation(Activity, android.view.View, String)was used to start an Activity, callback will be called to handle shared elements on the launchedActivity.

void setExitSharedElementCallback(SharedElementCallback listener)

When makeSceneTransitionAnimation(Activity, android.view.View, String)was used to start an Activity, listener will be called to handle shared elements on the launchingActivity.

void startActivityForResult(Intent intent, int requestCode, Bundle options)
void startActivityForResult(Intent intent, int requestCode)

Modifies the standard behavior to allow results to be delivered to fragments.

void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode)

Called by Fragment.startActivityForResult() to implement its behavior.

void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode, Bundle options)

Called by Fragment.startActivityForResult() to implement its behavior.

void startIntentSenderForResult(IntentSender intent, int requestCode, IntentfillInIntent, int flagsMask, int flagsValues, int extraFlags)
void startIntentSenderForResult(IntentSender intent, int requestCode, IntentfillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundleoptions)
void startIntentSenderFromFragment(Fragment fragment, IntentSender intent,int requestCode, Intent fillInIntent, int flagsMask, int flagsValues,int extraFlags, Bundle options)

Called by Fragment.startIntentSenderForResult() to implement its behavior.

void supportFinishAfterTransition()

Reverses the Activity Scene entry Transition and triggers the calling Activity to reverse its exit Transition.

void supportInvalidateOptionsMenu()

This method was deprecated in API level 26.1.0. Call invalidateOptionsMenu() directly.

void supportPostponeEnterTransition()

Support library version of postponeEnterTransition() that works only on API 21 and later.

void supportStartPostponedEnterTransition()

Support library version of startPostponedEnterTransition() that only works with API 21 and later.

final void validateRequestPermissionsRequestCode(int requestCode)
From class android.app.Activity
void addContentView(View arg0, ViewGroup.LayoutParams arg1)
void attachBaseContext(Context arg0)
void closeContextMenu()
void closeOptionsMenu()
PendingIntent createPendingResult(int arg0, Intent arg1, int arg2)
final void dismissDialog(int arg0)
final void dismissKeyboardShortcutsHelper()
boolean dispatchGenericMotionEvent(MotionEvent arg0)
boolean dispatchKeyEvent(KeyEvent arg0)
boolean dispatchKeyShortcutEvent(KeyEvent arg0)
boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent arg0)
boolean dispatchTouchEvent(MotionEvent arg0)
boolean dispatchTrackballEvent(MotionEvent arg0)
void dump(String arg0, FileDescriptor arg1, PrintWriter arg2, String[] arg3)
boolean enterPictureInPictureMode(PictureInPictureParams arg0)
void enterPictureInPictureMode()
<T extends View> T findViewById(int arg0)
void finish()
void finishActivity(int arg0)
void finishActivityFromChild(Activity arg0, int arg1)
void finishAffinity()
void finishAfterTransition()
void finishAndRemoveTask()
void finishFromChild(Activity arg0)
ActionBar getActionBar()
final Application getApplication()
ComponentName getCallingActivity()
String getCallingPackage()
int getChangingConfigurations()
ComponentName getComponentName()
Scene getContentScene()
TransitionManager getContentTransitionManager()
View getCurrentFocus()
FragmentManager getFragmentManager()
Intent getIntent()
Object getLastNonConfigurationInstance()
LayoutInflater getLayoutInflater()
LoaderManager getLoaderManager()
String getLocalClassName()
int getMaxNumPictureInPictureActions()
final MediaController getMediaController()
MenuInflater getMenuInflater()
final Activity getParent()
Intent getParentActivityIntent()
SharedPreferences getPreferences(int arg0)
Uri getReferrer()
int getRequestedOrientation()
final SearchEvent getSearchEvent()
Object getSystemService(String arg0)
int getTaskId()
final CharSequence getTitle()
final int getTitleColor()
VoiceInteractor getVoiceInteractor()
final int getVolumeControlStream()
Window getWindow()
WindowManager getWindowManager()
boolean hasWindowFocus()
void invalidateOptionsMenu()
boolean isActivityTransitionRunning()
boolean isChangingConfigurations()
final boolean isChild()
boolean isDestroyed()
boolean isFinishing()
boolean isImmersive()
boolean isInMultiWindowMode()
boolean isInPictureInPictureMode()
boolean isLocalVoiceInteractionSupported()
boolean isTaskRoot()
boolean isVoiceInteraction()
boolean isVoiceInteractionRoot()
final Cursor managedQuery(Uri arg0, String[] arg1, String arg2, String[] arg3,String arg4)
boolean moveTaskToBack(boolean arg0)
boolean navigateUpTo(Intent arg0)
boolean navigateUpToFromChild(Activity arg0, Intent arg1)
void onActionModeFinished(ActionMode arg0)
void onActionModeStarted(ActionMode arg0)
void onActivityReenter(int arg0, Intent arg1)
void onActivityResult(int arg0, int arg1, Intent arg2)
void onApplyThemeResource(Resources.Theme arg0, int arg1, boolean arg2)
void onAttachFragment(Fragment arg0)
void onAttachedToWindow()
void onBackPressed()
void onChildTitleChanged(Activity arg0, CharSequence arg1)
void onConfigurationChanged(Configuration arg0)
void onContentChanged()
boolean onContextItemSelected(MenuItem arg0)
void onContextMenuClosed(Menu arg0)
void onCreate(Bundle arg0, PersistableBundle arg1)
void onCreate(Bundle arg0)
void onCreateContextMenu(ContextMenu arg0, View arg1, ContextMenu.ContextMenuInfo arg2)
CharSequence onCreateDescription()
Dialog onCreateDialog(int arg0)
Dialog onCreateDialog(int arg0, Bundle arg1)
void onCreateNavigateUpTaskStack(TaskStackBuilder arg0)
boolean onCreateOptionsMenu(Menu arg0)
boolean onCreatePanelMenu(int arg0, Menu arg1)
View onCreatePanelView(int arg0)
boolean onCreateThumbnail(Bitmap arg0, Canvas arg1)
View onCreateView(View arg0, String arg1, Context arg2, AttributeSet arg3)
View onCreateView(String arg0, Context arg1, AttributeSet arg2)
void onDestroy()
void onDetachedFromWindow()
void onEnterAnimationComplete()
boolean onGenericMotionEvent(MotionEvent arg0)
boolean onKeyDown(int arg0, KeyEvent arg1)
boolean onKeyLongPress(int arg0, KeyEvent arg1)
boolean onKeyMultiple(int arg0, int arg1, KeyEvent arg2)
boolean onKeyShortcut(int arg0, KeyEvent arg1)
boolean onKeyUp(int arg0, KeyEvent arg1)
void onLocalVoiceInteractionStarted()
void onLocalVoiceInteractionStopped()
void onLowMemory()
boolean onMenuItemSelected(int arg0, MenuItem arg1)
boolean onMenuOpened(int arg0, Menu arg1)
void onMultiWindowModeChanged(boolean arg0)
void onMultiWindowModeChanged(boolean arg0, Configuration arg1)
boolean onNavigateUp()
boolean onNavigateUpFromChild(Activity arg0)
void onNewIntent(Intent arg0)
boolean onOptionsItemSelected(MenuItem arg0)
void onOptionsMenuClosed(Menu arg0)
void onPanelClosed(int arg0, Menu arg1)
void onPause()
void onPictureInPictureModeChanged(boolean arg0, Configuration arg1)
void onPictureInPictureModeChanged(boolean arg0)
void onPostCreate(Bundle arg0)
void onPostCreate(Bundle arg0, PersistableBundle arg1)
void onPostResume()
void onPrepareDialog(int arg0, Dialog arg1, Bundle arg2)
void onPrepareDialog(int arg0, Dialog arg1)
void onPrepareNavigateUpTaskStack(TaskStackBuilder arg0)
boolean onPrepareOptionsMenu(Menu arg0)
boolean onPreparePanel(int arg0, View arg1, Menu arg2)
void onProvideAssistContent(AssistContent arg0)
void onProvideAssistData(Bundle arg0)
void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> arg0, Menu arg1,int arg2)
Uri onProvideReferrer()
void onRequestPermissionsResult(int arg0, String[] arg1, int[] arg2)
void onRestart()
void onRestoreInstanceState(Bundle arg0)
void onRestoreInstanceState(Bundle arg0, PersistableBundle arg1)
void onResume()
Object onRetainNonConfigurationInstance()
void onSaveInstanceState(Bundle arg0, PersistableBundle arg1)
void onSaveInstanceState(Bundle arg0)
boolean onSearchRequested(SearchEvent arg0)
boolean onSearchRequested()
void onStart()
void onStateNotSaved()
void onStop()
void onTitleChanged(CharSequence arg0, int arg1)
boolean onTouchEvent(MotionEvent arg0)
boolean onTrackballEvent(MotionEvent arg0)
void onTrimMemory(int arg0)
void onUserInteraction()
void onUserLeaveHint()
void onVisibleBehindCanceled()
void onWindowAttributesChanged(WindowManager.LayoutParams arg0)
void onWindowFocusChanged(boolean arg0)
ActionMode onWindowStartingActionMode(ActionMode.Callback arg0, int arg1)
ActionMode onWindowStartingActionMode(ActionMode.Callback arg0)
void openContextMenu(View arg0)
void openOptionsMenu()
void overridePendingTransition(int arg0, int arg1)
void postponeEnterTransition()
void recreate()
void registerForContextMenu(View arg0)
boolean releaseInstance()
final void removeDialog(int arg0)
void reportFullyDrawn()
DragAndDropPermissions requestDragAndDropPermissions(DragEvent arg0)
final void requestPermissions(String[] arg0, int arg1)
final void requestShowKeyboardShortcuts()
boolean requestVisibleBehind(boolean arg0)
final boolean requestWindowFeature(int arg0)
final <T extends View> T requireViewById(int arg0)
final void runOnUiThread(Runnable arg0)
void setActionBar(Toolbar arg0)
void setContentTransitionManager(TransitionManager arg0)
void setContentView(View arg0, ViewGroup.LayoutParams arg1)
void setContentView(View arg0)
void setContentView(int arg0)
final void setDefaultKeyMode(int arg0)
void setEnterSharedElementCallback(SharedElementCallback arg0)
void setExitSharedElementCallback(SharedElementCallback arg0)
final void setFeatureDrawable(int arg0, Drawable arg1)
final void setFeatureDrawableAlpha(int arg0, int arg1)
final void setFeatureDrawableResource(int arg0, int arg1)
final void setFeatureDrawableUri(int arg0, Uri arg1)
void setFinishOnTouchOutside(boolean arg0)
void setImmersive(boolean arg0)
void setIntent(Intent arg0)
final void setMediaController(MediaController arg0)
void setPictureInPictureParams(PictureInPictureParams arg0)
final void setProgress(int arg0)
final void setProgressBarIndeterminate(boolean arg0)
final void setProgressBarIndeterminateVisibility(boolean arg0)
final void setProgressBarVisibility(boolean arg0)
void setRequestedOrientation(int arg0)
final void setResult(int arg0, Intent arg1)
final void setResult(int arg0)
final void setSecondaryProgress(int arg0)
void setShowWhenLocked(boolean arg0)
void setTaskDescription(ActivityManager.TaskDescription arg0)
void setTheme(int arg0)
void setTitle(CharSequence arg0)
void setTitle(int arg0)
void setTitleColor(int arg0)
void setTurnScreenOn(boolean arg0)
void setVisible(boolean arg0)
final void setVolumeControlStream(int arg0)
void setVrModeEnabled(boolean arg0, ComponentName arg1)
boolean shouldShowRequestPermissionRationale(String arg0)
boolean shouldUpRecreateTask(Intent arg0)
boolean showAssist(Bundle arg0)
final boolean showDialog(int arg0, Bundle arg1)
final void showDialog(int arg0)
void showLockTaskEscapeMessage()
ActionMode startActionMode(ActionMode.Callback arg0, int arg1)
ActionMode startActionMode(ActionMode.Callback arg0)
void startActivities(Intent[] arg0, Bundle arg1)
void startActivities(Intent[] arg0)
void startActivity(Intent arg0)
void startActivity(Intent arg0, Bundle arg1)
void startActivityForResult(Intent arg0, int arg1)
void startActivityForResult(Intent arg0, int arg1, Bundle arg2)
void startActivityFromChild(Activity arg0, Intent arg1, int arg2)
void startActivityFromChild(Activity arg0, Intent arg1, int arg2, Bundlearg3)
void startActivityFromFragment(Fragment arg0, Intent arg1, int arg2, Bundlearg3)
void startActivityFromFragment(Fragment arg0, Intent arg1, int arg2)
boolean startActivityIfNeeded(Intent arg0, int arg1, Bundle arg2)
boolean startActivityIfNeeded(Intent arg0, int arg1)
void startIntentSender(IntentSender arg0, Intent arg1, int arg2, int arg3,int arg4)
void startIntentSender(IntentSender arg0, Intent arg1, int arg2, int arg3,int arg4, Bundle arg5)
void startIntentSenderForResult(IntentSender arg0, int arg1, Intent arg2,int arg3, int arg4, int arg5)
void startIntentSenderForResult(IntentSender arg0, int arg1, Intent arg2,int arg3, int arg4, int arg5, Bundle arg6)
void startIntentSenderFromChild(Activity arg0, IntentSender arg1, int arg2,Intent arg3, int arg4, int arg5, int arg6, Bundle arg7)
void startIntentSenderFromChild(Activity arg0, IntentSender arg1, int arg2,Intent arg3, int arg4, int arg5, int arg6)
void startLocalVoiceInteraction(Bundle arg0)
void startLockTask()
void startManagingCursor(Cursor arg0)
boolean startNextMatchingActivity(Intent arg0, Bundle arg1)
boolean startNextMatchingActivity(Intent arg0)
void startPostponedEnterTransition()
void startSearch(String arg0, boolean arg1, Bundle arg2, boolean arg3)
void stopLocalVoiceInteraction()
void stopLockTask()
void stopManagingCursor(Cursor arg0)
void takeKeyEvents(boolean arg0)
void triggerSearch(String arg0, Bundle arg1)
void unregisterForContextMenu(View arg0)
From class android.view.ContextThemeWrapper
void applyOverrideConfiguration(Configuration arg0)
void attachBaseContext(Context arg0)
AssetManager getAssets()
Resources getResources()
Object getSystemService(String arg0)
Resources.Theme getTheme()
void onApplyThemeResource(Resources.Theme arg0, int arg1, boolean arg2)
void setTheme(int arg0)
From class android.content.ContextWrapper
void attachBaseContext(Context arg0)
boolean bindService(Intent arg0, ServiceConnection arg1, int arg2)
int checkCallingOrSelfPermission(String arg0)
int checkCallingOrSelfUriPermission(Uri arg0, int arg1)
int checkCallingPermission(String arg0)
int checkCallingUriPermission(Uri arg0, int arg1)
int checkPermission(String arg0, int arg1, int arg2)
int checkSelfPermission(String arg0)
int checkUriPermission(Uri arg0, String arg1, String arg2, int arg3, int arg4, int arg5)
int checkUriPermission(Uri arg0, int arg1, int arg2, int arg3)
void clearWallpaper()
Context createConfigurationContext(Configuration arg0)
Context createContextForSplit(String arg0)
Context createDeviceProtectedStorageContext()
Context createDisplayContext(Display arg0)
Context createPackageContext(String arg0, int arg1)
String[] databaseList()
boolean deleteDatabase(String arg0)
boolean deleteFile(String arg0)
boolean deleteSharedPreferences(String arg0)
void enforceCallingOrSelfPermission(String arg0, String arg1)
void enforceCallingOrSelfUriPermission(Uri arg0, int arg1, String arg2)
void enforceCallingPermission(String arg0, String arg1)
void enforceCallingUriPermission(Uri arg0, int arg1, String arg2)
void enforcePermission(String arg0, int arg1, int arg2, String arg3)
void enforceUriPermission(Uri arg0, String arg1, String arg2, int arg3, int arg4, int arg5, String arg6)
void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3, String arg4)
String[] fileList()
Context getApplicationContext()
ApplicationInfo getApplicationInfo()
AssetManager getAssets()
Context getBaseContext()
File getCacheDir()
ClassLoader getClassLoader()
File getCodeCacheDir()
ContentResolver getContentResolver()
File getDataDir()
File getDatabasePath(String arg0)
File getDir(String arg0, int arg1)
File getExternalCacheDir()
File[] getExternalCacheDirs()
File getExternalFilesDir(String arg0)
File[] getExternalFilesDirs(String arg0)
File[] getExternalMediaDirs()
File getFileStreamPath(String arg0)
File getFilesDir()
Executor getMainExecutor()
Looper getMainLooper()
File getNoBackupFilesDir()
File getObbDir()
File[] getObbDirs()
String getPackageCodePath()
PackageManager getPackageManager()
String getPackageName()
String getPackageResourcePath()
Resources getResources()
SharedPreferences getSharedPreferences(String arg0, int arg1)
Object getSystemService(String arg0)
String getSystemServiceName(Class<?> arg0)
Resources.Theme getTheme()
Drawable getWallpaper()
int getWallpaperDesiredMinimumHeight()
int getWallpaperDesiredMinimumWidth()
void grantUriPermission(String arg0, Uri arg1, int arg2)
boolean isDeviceProtectedStorage()
boolean isRestricted()
boolean moveDatabaseFrom(Context arg0, String arg1)
boolean moveSharedPreferencesFrom(Context arg0, String arg1)
FileInputStream openFileInput(String arg0)
FileOutputStream openFileOutput(String arg0, int arg1)
SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, SQLiteDatabase.CursorFactory arg2, DatabaseErrorHandler arg3)
SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, SQLiteDatabase.CursorFactory arg2)
Drawable peekWallpaper()
Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1)
Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1, int arg2)
Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1, String arg2, Handler arg3, int arg4)
Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1, String arg2, Handler arg3)
void removeStickyBroadcast(Intent arg0)
void removeStickyBroadcastAsUser(Intent arg0, UserHandle arg1)
void revokeUriPermission(Uri arg0, int arg1)
void revokeUriPermission(String arg0, Uri arg1, int arg2)
void sendBroadcast(Intent arg0, String arg1)
void sendBroadcast(Intent arg0)
void sendBroadcastAsUser(Intent arg0, UserHandle arg1)
void sendBroadcastAsUser(Intent arg0, UserHandle arg1, String arg2)
void sendOrderedBroadcast(Intent arg0, String arg1, BroadcastReceiver arg2,Handler arg3, int arg4, String arg5, Bundle arg6)
void sendOrderedBroadcast(Intent arg0, String arg1)
void sendOrderedBroadcastAsUser(Intent arg0, UserHandle arg1, String arg2,BroadcastReceiver arg3, Handler arg4, int arg5, String arg6, Bundlearg7)
void sendStickyBroadcast(Intent arg0)
void sendStickyBroadcastAsUser(Intent arg0, UserHandle arg1)
void sendStickyOrderedBroadcast(Intent arg0, BroadcastReceiver arg1, Handlerarg2, int arg3, String arg4, Bundle arg5)
void sendStickyOrderedBroadcastAsUser(Intent arg0, UserHandle arg1,BroadcastReceiver arg2, Handler arg3, int arg4, String arg5, Bundlearg6)
void setTheme(int arg0)
void setWallpaper(Bitmap arg0)
void setWallpaper(InputStream arg0)
void startActivities(Intent[] arg0, Bundle arg1)
void startActivities(Intent[] arg0)
void startActivity(Intent arg0)
void startActivity(Intent arg0, Bundle arg1)
ComponentName startForegroundService(Intent arg0)
boolean startInstrumentation(ComponentName arg0, String arg1, Bundle arg2)
void startIntentSender(IntentSender arg0, Intent arg1, int arg2, int arg3,int arg4)
void startIntentSender(IntentSender arg0, Intent arg1, int arg2, int arg3,int arg4, Bundle arg5)
ComponentName startService(Intent arg0)
boolean stopService(Intent arg0)
void unbindService(ServiceConnection arg0)
void unregisterReceiver(BroadcastReceiver arg0)
From class android.content.Context
abstract boolean bindService(Intent arg0, ServiceConnection arg1, int arg2)
abstract int checkCallingOrSelfPermission(String arg0)
abstract int checkCallingOrSelfUriPermission(Uri arg0, int arg1)
abstract int checkCallingPermission(String arg0)
abstract int checkCallingUriPermission(Uri arg0, int arg1)
abstract int checkPermission(String arg0, int arg1, int arg2)
abstract int checkSelfPermission(String arg0)
abstract int checkUriPermission(Uri arg0, String arg1, String arg2, int arg3, int arg4, int arg5)
abstract int checkUriPermission(Uri arg0, int arg1, int arg2, int arg3)
abstract void clearWallpaper()
abstract Context createConfigurationContext(Configuration arg0)
abstract Context createContextForSplit(String arg0)
abstract Context createDeviceProtectedStorageContext()
abstract Context createDisplayContext(Display arg0)
abstract Context createPackageContext(String arg0, int arg1)
abstract String[] databaseList()
abstract boolean deleteDatabase(String arg0)
abstract boolean deleteFile(String arg0)
abstract boolean deleteSharedPreferences(String arg0)
abstract void enforceCallingOrSelfPermission(String arg0, String arg1)
abstract void enforceCallingOrSelfUriPermission(Uri arg0, int arg1, String arg2)
abstract void enforceCallingPermission(String arg0, String arg1)
abstract void enforceCallingUriPermission(Uri arg0, int arg1, String arg2)
abstract void enforcePermission(String arg0, int arg1, int arg2, String arg3)
abstract void enforceUriPermission(Uri arg0, String arg1, String arg2, int arg3,int arg4, int arg5, String arg6)
abstract void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3, String arg4)
abstract String[] fileList()
abstract Context getApplicationContext()
abstract ApplicationInfo getApplicationInfo()
abstract AssetManager getAssets()
abstract File getCacheDir()
abstract ClassLoader getClassLoader()
abstract File getCodeCacheDir()
final int getColor(int arg0)
final ColorStateList getColorStateList(int arg0)
abstract ContentResolver getContentResolver()
abstract File getDataDir()
abstract File getDatabasePath(String arg0)
abstract File getDir(String arg0, int arg1)
final Drawable getDrawable(int arg0)
abstract File getExternalCacheDir()
abstract File[] getExternalCacheDirs()
abstract File getExternalFilesDir(String arg0)
abstract File[] getExternalFilesDirs(String arg0)
abstract File[] getExternalMediaDirs()
abstract File getFileStreamPath(String arg0)
abstract File getFilesDir()
Executor getMainExecutor()
abstract Looper getMainLooper()
abstract File getNoBackupFilesDir()
abstract File getObbDir()
abstract File[] getObbDirs()
abstract String getPackageCodePath()
abstract PackageManager getPackageManager()
abstract String getPackageName()
abstract String getPackageResourcePath()
abstract Resources getResources()
abstract SharedPreferences getSharedPreferences(String arg0, int arg1)
final String getString(int arg0, Object... arg1)
final String getString(int arg0)
final <T> T getSystemService(Class<T> arg0)
abstract Object getSystemService(String arg0)
abstract String getSystemServiceName(Class<?> arg0)
final CharSequence getText(int arg0)
abstract Resources.Theme getTheme()
abstract Drawable getWallpaper()
abstract int getWallpaperDesiredMinimumHeight()
abstract int getWallpaperDesiredMinimumWidth()
abstract void grantUriPermission(String arg0, Uri arg1, int arg2)
abstract boolean isDeviceProtectedStorage()
boolean isRestricted()
abstract boolean moveDatabaseFrom(Context arg0, String arg1)
abstract boolean moveSharedPreferencesFrom(Context arg0, String arg1)
final TypedArray obtainStyledAttributes(AttributeSet arg0, int[] arg1)
final TypedArray obtainStyledAttributes(AttributeSet arg0, int[] arg1, int arg2, int arg3)
final TypedArray obtainStyledAttributes(int arg0, int[] arg1)
final TypedArray obtainStyledAttributes(int[] arg0)
abstract FileInputStream openFileInput(String arg0)
abstract FileOutputStream openFileOutput(String arg0, int arg1)
abstract SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, SQLiteDatabase.CursorFactory arg2, DatabaseErrorHandler arg3)
abstract SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, SQLiteDatabase.CursorFactory arg2)
abstract Drawable peekWallpaper()
void registerComponentCallbacks(ComponentCallbacks arg0)
abstract Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1)
abstract Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1, int arg2)
abstract Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1, String arg2, Handler arg3, int arg4)
abstract Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1, String arg2, Handler arg3)
abstract void removeStickyBroadcast(Intent arg0)
abstract void removeStickyBroadcastAsUser(Intent arg0, UserHandle arg1)
abstract void revokeUriPermission(Uri arg0, int arg1)
abstract void revokeUriPermission(String arg0, Uri arg1, int arg2)
abstract void sendBroadcast(Intent arg0, String arg1)
abstract void sendBroadcast(Intent arg0)
abstract void sendBroadcastAsUser(Intent arg0, UserHandle arg1)
abstract void sendBroadcastAsUser(Intent arg0, UserHandle arg1, String arg2)
abstract void sendOrderedBroadcast(Intent arg0, String arg1, BroadcastReceiverarg2, Handler arg3, int arg4, String arg5, Bundle arg6)
abstract void sendOrderedBroadcast(Intent arg0, String arg1)
abstract void sendOrderedBroadcastAsUser(Intent arg0, UserHandle arg1, String arg2,BroadcastReceiver arg3, Handler arg4, int arg5, String arg6, Bundlearg7)
abstract void sendStickyBroadcast(Intent arg0)
abstract void sendStickyBroadcastAsUser(Intent arg0, UserHandle arg1)
abstract void sendStickyOrderedBroadcast(Intent arg0, BroadcastReceiver arg1,Handler arg2, int arg3, String arg4, Bundle arg5)
abstract void sendStickyOrderedBroadcastAsUser(Intent arg0, UserHandle arg1,BroadcastReceiver arg2, Handler arg3, int arg4, String arg5, Bundlearg6)
abstract void setTheme(int arg0)
abstract void setWallpaper(Bitmap arg0)
abstract void setWallpaper(InputStream arg0)
abstract void startActivities(Intent[] arg0, Bundle arg1)
abstract void startActivities(Intent[] arg0)
abstract void startActivity(Intent arg0)
abstract void startActivity(Intent arg0, Bundle arg1)
abstract ComponentName startForegroundService(Intent arg0)
abstract boolean startInstrumentation(ComponentName arg0, String arg1, Bundle arg2)
abstract void startIntentSender(IntentSender arg0, Intent arg1, int arg2, int arg3,int arg4)
abstract void startIntentSender(IntentSender arg0, Intent arg1, int arg2, int arg3,int arg4, Bundle arg5)
abstract ComponentName startService(Intent arg0)
abstract boolean stopService(Intent arg0)
abstract void unbindService(ServiceConnection arg0)
void unregisterComponentCallbacks(ComponentCallbacks arg0)
abstract void unregisterReceiver(BroadcastReceiver arg0)
From class java.lang.Object
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait(long arg0, int arg1)
final void wait(long arg0)
final void wait()
From interface android.arch.lifecycle.ViewModelStoreOwner
abstract ViewModelStore getViewModelStore()
From interface android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback
abstract void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)

Callback for the result from requesting permissions.

From interface android.arch.lifecycle.LifecycleOwner
abstract Lifecycle getLifecycle()
From interface android.view.LayoutInflater.Factory2
abstract View onCreateView(View arg0, String arg1, Context arg2, AttributeSet arg3)
From interface android.view.Window.Callback
abstract boolean dispatchGenericMotionEvent(MotionEvent arg0)
abstract boolean dispatchKeyEvent(KeyEvent arg0)
abstract boolean dispatchKeyShortcutEvent(KeyEvent arg0)
abstract boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent arg0)
abstract boolean dispatchTouchEvent(MotionEvent arg0)
abstract boolean dispatchTrackballEvent(MotionEvent arg0)
abstract void onActionModeFinished(ActionMode arg0)
abstract void onActionModeStarted(ActionMode arg0)
abstract void onAttachedToWindow()
abstract void onContentChanged()
abstract boolean onCreatePanelMenu(int arg0, Menu arg1)
abstract View onCreatePanelView(int arg0)
abstract void onDetachedFromWindow()
abstract boolean onMenuItemSelected(int arg0, MenuItem arg1)
abstract boolean onMenuOpened(int arg0, Menu arg1)
abstract void onPanelClosed(int arg0, Menu arg1)
default void onPointerCaptureChanged(boolean arg0)
abstract boolean onPreparePanel(int arg0, View arg1, Menu arg2)
default void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> arg0, Menu arg1,int arg2)
abstract boolean onSearchRequested()
abstract boolean onSearchRequested(SearchEvent arg0)
abstract void onWindowAttributesChanged(WindowManager.LayoutParams arg0)
abstract void onWindowFocusChanged(boolean arg0)
abstract ActionMode onWindowStartingActionMode(ActionMode.Callback arg0)
abstract ActionMode onWindowStartingActionMode(ActionMode.Callback arg0, int arg1)
From interface android.view.KeyEvent.Callback
abstract boolean onKeyDown(int arg0, KeyEvent arg1)
abstract boolean onKeyLongPress(int arg0, KeyEvent arg1)
abstract boolean onKeyMultiple(int arg0, int arg1, KeyEvent arg2)
abstract boolean onKeyUp(int arg0, KeyEvent arg1)
From interface android.view.View.OnCreateContextMenuListener
abstract void onCreateContextMenu(ContextMenu arg0, View arg1, ContextMenu.ContextMenuInfo arg2)
From interface android.content.ComponentCallbacks2
abstract void onTrimMemory(int arg0)
From interface android.support.v7.app.AppCompatCallback
abstract void onSupportActionModeFinished(ActionMode mode)

Called when a support action mode has finished.

abstract void onSupportActionModeStarted(ActionMode mode)

Called when a support action mode has been started.

abstract ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback)

Called when a support action mode is being started for this window.

From interface android.support.v4.app.TaskStackBuilder.SupportParentable
abstract Intent getSupportParentActivityIntent()
From interface android.support.v7.app.ActionBarDrawerToggle.DelegateProvider
abstract ActionBarDrawerToggle.Delegate getDrawerToggleDelegate()
From interface android.view.LayoutInflater.Factory
abstract View onCreateView(String arg0, Context arg1, AttributeSet arg2)
From interface android.content.ComponentCallbacks
abstract void onConfigurationChanged(Configuration arg0)
abstract void onLowMemory()

Public constructors

AppCompatActivity

added in version 25.1.0

 

AppCompatActivity ()

Public methods

addContentView

 

void addContentView (View view, ViewGroup.LayoutParams params)

Parameters
view View
params ViewGroup.LayoutParams

closeOptionsMenu

 

void closeOptionsMenu ()

dispatchKeyEvent

 

boolean dispatchKeyEvent (KeyEvent event)

Parameters
event KeyEvent
Returns
boolean

findViewById

 

T findViewById (int id)

Parameters
id int
Returns
T

getDelegate

added in version 25.1.0

 

AppCompatDelegate getDelegate ()

Returns
AppCompatDelegate The AppCompatDelegate being used by this Activity.

getDrawerToggleDelegate

added in version 25.1.0

 

ActionBarDrawerToggle.Delegate getDrawerToggleDelegate ()

Returns
ActionBarDrawerToggle.Delegate

getMenuInflater

 

MenuInflater getMenuInflater ()

Returns
MenuInflater

getResources

 

Resources getResources ()

Returns
Resources

getSupportActionBar

added in version 25.1.0

 

ActionBar getSupportActionBar ()

Support library version of getActionBar().

Retrieve a reference to this activity's ActionBar.

Returns
ActionBar The Activity's ActionBar, or null if it does not have one.

getSupportParentActivityIntent

added in version 25.1.0

 

Intent getSupportParentActivityIntent ()

Obtain an Intent that will launch an explicit target activity specified by sourceActivity's PARENT_ACTIVITY <meta-data> element in the application's manifest. If the device is running Jellybean or newer, the android:parentActivityName attribute will be preferred if it is present.

Returns
Intent a new Intent targeting the defined parent activity of sourceActivity

invalidateOptionsMenu

 

void invalidateOptionsMenu ()

onConfigurationChanged

 

void onConfigurationChanged (Configuration newConfig)

Dispatch configuration change to all fragments.

Parameters
newConfig Configuration

onContentChanged

 

void onContentChanged ()

onCreateSupportNavigateUpTaskStack

added in version 25.1.0

 

void onCreateSupportNavigateUpTaskStack (TaskStackBuilder builder)

Support version of onCreateNavigateUpTaskStack(android.app.TaskStackBuilder). This method will be called on all platform versions. Define the synthetic task stack that will be generated during Up navigation from a different task.

The default implementation of this method adds the parent chain of this activity as specified in the manifest to the supplied TaskStackBuilder. Applications may choose to override this method to construct the desired task stack in a different way.

This method will be invoked by the default implementation of onNavigateUp() if shouldUpRecreateTask(android.content.Intent) returns true when supplied with the intent returned by getParentActivityIntent().

Applications that wish to supply extra Intent parameters to the parent stack defined by the manifest should overrideonPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder).

Parameters
builder TaskStackBuilder: An empty TaskStackBuilder - the application should add intents representing the desired task stack

onKeyDown

 

boolean onKeyDown (int keyCode, KeyEvent event)

Parameters
keyCode int
event KeyEvent
Returns
boolean

onMenuItemSelected

added in version 25.1.0

 

boolean onMenuItemSelected (int featureId, MenuItem item)

Dispatch context and options menu to fragments.

Parameters
featureId int
item MenuItem
Returns
boolean

onMenuOpened

 

boolean onMenuOpened (int featureId, Menu menu)

Please note: AppCompat uses its own feature id for the action bar: FEATURE_SUPPORT_ACTION_BAR.

Parameters
featureId int
menu Menu
Returns
boolean

onPanelClosed

 

void onPanelClosed (int featureId, Menu menu)

Call onOptionsMenuClosed() on fragments.

Please note: AppCompat uses its own feature id for the action bar: FEATURE_SUPPORT_ACTION_BAR.

Parameters
featureId int
menu Menu

onPrepareSupportNavigateUpTaskStack

added in version 25.1.0

 

void onPrepareSupportNavigateUpTaskStack (TaskStackBuilder builder)

Support version of onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder). This method will be called on all platform versions. Prepare the synthetic task stack that will be generated during Up navigation from a different task.

This method receives the TaskStackBuilder with the constructed series of Intents as generated by onCreateSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder). If any extra data should be added to these intents before launching the new task, the application should override this method and add that data here.

Parameters
builder TaskStackBuilder: A TaskStackBuilder that has been populated with Intents by onCreateNavigateUpTaskStack.

onSupportActionModeFinished

added in version 25.1.0

 

void onSupportActionModeFinished (ActionMode mode)

Notifies the activity that a support action mode has finished. Activity subclasses overriding this method should call the superclass implementation.

Parameters
mode ActionMode: The action mode that just finished.

onSupportActionModeStarted

added in version 25.1.0

 

void onSupportActionModeStarted (ActionMode mode)

Notifies the Activity that a support action mode has been started. Activity subclasses overriding this method should call the superclass implementation.

Parameters
mode ActionMode: The new action mode.

onSupportContentChanged

added in version 25.1.0

 

void onSupportContentChanged ()

This method was deprecated in API level 25.1.0.
Use onContentChanged() instead.

onSupportNavigateUp

added in version 25.1.0

 

boolean onSupportNavigateUp ()

This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.

If a parent was specified in the manifest for this activity or an activity-alias to it, default Up navigation will be handled automatically. See getSupportParentActivityIntent() for how to specify the parent. If any activity along the parent chain requires extra Intent arguments, the Activity subclass should override the method onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder) to supply those arguments.

See Tasks and Back Stack from the developer guide and Navigation from the design guide for more information about navigating within your app.

See the TaskStackBuilder class and the Activity methods getSupportParentActivityIntent()supportShouldUpRecreateTask(android.content.Intent), andsupportNavigateUpTo(android.content.Intent) for help implementing custom Up navigation.

Returns
boolean true if Up navigation completed successfully and this Activity was finished, false otherwise.

onWindowStartingSupportActionMode

added in version 25.1.0

 

ActionMode onWindowStartingSupportActionMode (ActionMode.Callback callback)

Called when a support action mode is being started for this window. Gives the callback an opportunity to handle the action mode in its own unique and beautiful way. If this method returns null the system can choose a way to present the mode or choose not to start the mode at all.

Parameters
callback ActionMode.Callback: Callback to control the lifecycle of this action mode
Returns
ActionMode The ActionMode that was started, or null if the system should present it

openOptionsMenu

 

void openOptionsMenu ()

setContentView

 

void setContentView (View view)

Parameters
view View

setContentView

 

void setContentView (int layoutResID)

Parameters
layoutResID int

setContentView

 

void setContentView (View view, ViewGroup.LayoutParams params)

Parameters
view View
params ViewGroup.LayoutParams

setSupportActionBar

added in version 25.1.0

 

void setSupportActionBar (Toolbar toolbar)

Set a Toolbar to act as the ActionBar for this Activity window.

When set to a non-null value the getActionBar() method will return an ActionBar object that can be used to control the given toolbar as if it were a traditional window decor action bar. The toolbar's menu will be populated with the Activity's options menu and the navigation button will be wired through the standard home menu select action.

In order to use a Toolbar within the Activity's window content the application must not request the window featureFEATURE_SUPPORT_ACTION_BAR.

Parameters
toolbar Toolbar: Toolbar to set as the Activity's action bar, or null to clear it

setSupportProgress

added in version 25.1.0

 

void setSupportProgress (int progress)

This method was deprecated in API level 25.1.0.
Progress bars are no longer provided in AppCompat.

Parameters
progress int

setSupportProgressBarIndeterminate

added in version 25.1.0

 

void setSupportProgressBarIndeterminate (boolean indeterminate)

This method was deprecated in API level 25.1.0.
Progress bars are no longer provided in AppCompat.

Parameters
indeterminate boolean

setSupportProgressBarIndeterminateVisibility

added in version 25.1.0

 

void setSupportProgressBarIndeterminateVisibility (boolean visible)

This method was deprecated in API level 25.1.0.
Progress bars are no longer provided in AppCompat.

Parameters
visible boolean

setSupportProgressBarVisibility

added in version 25.1.0

 

void setSupportProgressBarVisibility (boolean visible)

This method was deprecated in API level 25.1.0.
Progress bars are no longer provided in AppCompat.

Parameters
visible boolean

setTheme

 

void setTheme (int resid)

Parameters
resid int

startSupportActionMode

added in version 25.1.0

 

ActionMode startSupportActionMode (ActionMode.Callback callback)

Start an action mode.

Parameters
callback ActionMode.Callback: Callback that will manage lifecycle events for this context mode
Returns
ActionMode The ContextMode that was started, or null if it was canceled

supportInvalidateOptionsMenu

added in version 25.1.0

 

void supportInvalidateOptionsMenu ()

This method is deprecated.
Call invalidateOptionsMenu() directly.

Support library version of invalidateOptionsMenu().

Invalidate the activity's options menu. This will cause relevant presentations of the menu to fully update via calls to onCreateOptionsMenu and onPrepareOptionsMenu the next time the menu is requested.

supportNavigateUpTo

added in version 25.1.0

 

void supportNavigateUpTo (Intent upIntent)

Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process. upIntent will have the flag FLAG_ACTIVITY_CLEAR_TOP set by this method, along with any others required for proper up navigation as outlined in the Android Design Guide.

This method should be used when performing up navigation from within the same task as the destination. If up navigation should cross tasks in some cases, see supportShouldUpRecreateTask(android.content.Intent).

Parameters
upIntent Intent: An intent representing the target destination for up navigation

supportRequestWindowFeature

added in version 25.1.0

 

boolean supportRequestWindowFeature (int featureId)

Enable extended support library window features.

This is a convenience for calling getWindow().requestFeature().

Parameters
featureId int: The desired feature as defined in Window or WindowCompat.
Returns
boolean Returns true if the requested feature is supported and now enabled.

See also:

supportShouldUpRecreateTask

added in version 25.1.0

 

boolean supportShouldUpRecreateTask (Intent targetIntent)

Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent.

If this method returns false the app can trivially call supportNavigateUpTo(android.content.Intent) using the same parameters to correctly perform up navigation. If this method returns false, the app should synthesize a new task stack by using TaskStackBuilder or another similar mechanism to perform up navigation.

Parameters
targetIntent Intent: An intent representing the target destination for up navigation
Returns
boolean true if navigating up should recreate a new task stack, false if the same task should be used for the destination

Protected methods

onCreate

added in version 26.1.0

 

void onCreate (Bundle savedInstanceState)

Perform initialization of all fragments.

Parameters
savedInstanceState Bundle

onDestroy

 

void onDestroy ()

Destroy all fragments.

onPostCreate

 

void onPostCreate (Bundle savedInstanceState)

Parameters
savedInstanceState Bundle

onPostResume

 

void onPostResume ()

Dispatch onResume() to fragments.

onSaveInstanceState

added in version 26.1.0

 

void onSaveInstanceState (Bundle outState)

Save all appropriate fragment state.

Parameters
outState Bundle

onStart

 

void onStart ()

Dispatch onStart() to all fragments.

onStop

 

void onStop ()

Dispatch onStop() to all fragments.

onTitleChanged

 

void onTitleChanged (CharSequence title, int color)

Parameters
title CharSequence
color int

猜你喜欢

转载自blog.csdn.net/u011038298/article/details/84846425