public class SearchActivity
extends android.app.Activity
implements android.app.ActionBar.OnNavigationListener
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_SHOWING_UI, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, COUNTRY_DETECTOR, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_ROUTER_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_POLICY_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SIP_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
SearchActivity() |
Modifier and Type | Method and Description |
---|---|
protected void |
onCreate(android.os.Bundle savedInstanceState)
Called when the activity is starting.
|
boolean |
onNavigationItemSelected(int position,
long id)
This method is called whenever a navigation item in your action bar
is selected.
|
void |
onRestoreInstanceState(android.os.Bundle savedInstanceState)
This method is called after
Activity.onStart() when the activity is
being re-initialized from a previously saved state, given here in
savedInstanceState. |
void |
onSaveInstanceState(android.os.Bundle outState)
Called to retrieve per-instance state from an activity before being killed
so that the state can be restored in
Activity.onCreate(android.os.Bundle) or
Activity.onRestoreInstanceState(android.os.Bundle) (the Bundle populated by this method
will be passed to both). |
static android.content.Intent |
startActivity(android.app.Activity activity) |
addContentView, closeContextMenu, closeOptionsMenu, convertFromTranslucent, convertToTranslucent, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishFromChild, getActionBar, getActivityToken, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isResumed, isTaskRoot, managedQuery, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityResult, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDestroy, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPause, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onProvideAssistData, onRestart, onResume, onRetainNonConfigurationInstance, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, recreate, registerForContextMenu, removeDialog, reportFullyDrawn, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, shouldUpRecreateTask, showDialog, showDialog, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityAsUser, startActivityAsUser, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
applyOverrideConfiguration, attachBaseContext, getResources, getTheme, getThemeResId, setTheme
bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, createPackageContextAsUser, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getBasePackageName, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getDisplayAdjustments, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSharedPrefsFile, getUserId, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startActivitiesAsUser, startInstrumentation, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver
public static android.content.Intent startActivity(android.app.Activity activity)
protected void onCreate(android.os.Bundle savedInstanceState)
android.app.Activity
Activity.setContentView(int)
to inflate the
activity's UI, using Activity.findViewById(int)
to programmatically interact
with widgets in the UI, calling
Activity.managedQuery(android.net.Uri , String[], String, String[], String)
to retrieve
cursors for data being displayed, etc.
You can call Activity.finish()
from within this function, in
which case onDestroy() will be immediately called without any of the rest
of the activity lifecycle (Activity.onStart()
, Activity.onResume()
,
Activity.onPause()
, etc) executing.
Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.
onCreate
in class android.app.Activity
savedInstanceState
- If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in Activity.onSaveInstanceState(android.os.Bundle)
. Note: Otherwise it is null.Activity.onStart()
,
Activity.onSaveInstanceState(android.os.Bundle)
,
Activity.onRestoreInstanceState(android.os.Bundle)
,
Activity.onPostCreate(android.os.Bundle)
public void onRestoreInstanceState(android.os.Bundle savedInstanceState)
android.app.Activity
Activity.onStart()
when the activity is
being re-initialized from a previously saved state, given here in
savedInstanceState. Most implementations will simply use Activity.onCreate(android.os.Bundle)
to restore their state, but it is sometimes convenient to do it here
after all of the initialization has been done or to allow subclasses to
decide whether to use your default implementation. The default
implementation of this method performs a restore of any view state that
had previously been frozen by Activity.onSaveInstanceState(android.os.Bundle)
.
This method is called between Activity.onStart()
and
Activity.onPostCreate(android.os.Bundle)
.
onRestoreInstanceState
in class android.app.Activity
savedInstanceState
- the data most recently supplied in Activity.onSaveInstanceState(android.os.Bundle)
.Activity.onCreate(android.os.Bundle)
,
Activity.onPostCreate(android.os.Bundle)
,
Activity.onResume()
,
Activity.onSaveInstanceState(android.os.Bundle)
public void onSaveInstanceState(android.os.Bundle outState)
android.app.Activity
Activity.onCreate(android.os.Bundle)
or
Activity.onRestoreInstanceState(android.os.Bundle)
(the Bundle
populated by this method
will be passed to both).
This method is called before an activity may be killed so that when it
comes back some time in the future it can restore its state. For example,
if activity B is launched in front of activity A, and at some point activity
A is killed to reclaim resources, activity A will have a chance to save the
current state of its user interface via this method so that when the user
returns to activity A, the state of the user interface can be restored
via Activity.onCreate(android.os.Bundle)
or Activity.onRestoreInstanceState(android.os.Bundle)
.
Do not confuse this method with activity lifecycle callbacks such as
Activity.onPause()
, which is always called when an activity is being placed
in the background or on its way to destruction, or Activity.onStop()
which
is called before destruction. One example of when Activity.onPause()
and
Activity.onStop()
is called and not this method is when a user navigates back
from activity B to activity A: there is no need to call Activity.onSaveInstanceState(android.os.Bundle)
on B because that particular instance will never be restored, so the
system avoids calling it. An example when Activity.onPause()
is called and
not Activity.onSaveInstanceState(android.os.Bundle)
is when activity B is launched in front of activity A:
the system may avoid calling Activity.onSaveInstanceState(android.os.Bundle)
on activity A if it isn't
killed during the lifetime of B since the state of the user interface of
A will stay intact.
The default implementation takes care of most of the UI per-instance
state for you by calling View.onSaveInstanceState()
on each
view in the hierarchy that has an id, and by saving the id of the currently
focused view (all of which is restored by the default implementation of
Activity.onRestoreInstanceState(android.os.Bundle)
). If you override this method to save additional
information not captured by each individual view, you will likely want to
call through to the default implementation, otherwise be prepared to save
all of the state of each view yourself.
If called, this method will occur before Activity.onStop()
. There are
no guarantees about whether it will occur before or after Activity.onPause()
.
onSaveInstanceState
in class android.app.Activity
outState
- Bundle in which to place your saved state.Activity.onCreate(android.os.Bundle)
,
Activity.onRestoreInstanceState(android.os.Bundle)
,
Activity.onPause()
public boolean onNavigationItemSelected(int position, long id)
android.app.ActionBar.OnNavigationListener
onNavigationItemSelected
in interface android.app.ActionBar.OnNavigationListener
position
- Position of the item clicked.id
- ID of the item clicked.