Application 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
維護全域應用程式狀態的基類。
[Android.Runtime.Register("android/app/Application", DoNotGenerateAcw=true)]
public class Application : Android.Content.ContextWrapper, Android.Content.IComponentCallbacks2, IDisposable
[<Android.Runtime.Register("android/app/Application", DoNotGenerateAcw=true)>]
type Application = class
inherit ContextWrapper
interface IComponentCallbacks
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IComponentCallbacks2
- 繼承
- 衍生
- 屬性
- 實作
備註
維護全域應用程式狀態的基類。 你可以自己實作,建立一個子類別,並在 AndroidManifest.xml<的應用程式> 標籤中指定該子類別的完全限定名稱為「android:name」屬性。 建立應用程式/封裝的程式時,Application 類別或 Application 類別的子類別會在任何其他類別之前具現化。 注意:通常不需要對應用進行子職業。 在大部分情況下,靜態單一專案可以更模組化的方式提供相同的功能。 如果你的單例需要全域上下文(例如註冊廣播接收器),在呼叫單例的 getInstance() 方法時,將 Context.getApplicationContext() 作為上下文參數。
Android 參考資料。android.app.Application
此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。
建構函式
| 名稱 | Description |
|---|---|
| Application() |
維護全域應用程式狀態的基類。 |
| Application(IntPtr, JniHandleOwnership) |
初始化現有 Java 原生介面物件的受管理表示。 |
欄位
| 名稱 | Description |
|---|---|
| AccessibilityService |
使用 搭配 |
| AccountService |
使用 搭配 |
| ActivityService |
使用 來 |
| AdvancedProtectionService |
使用 以 |
| AlarmService |
使用 搭配 |
| AppFunctionService |
用 來 |
| AppOpsService |
使用搭配 |
| AppSearchService |
使用 搭配 |
| AppwidgetService |
使用 搭配 |
| AudioService |
使用 搭配 |
| BatteryService |
使用搭配 |
| BindAllowActivityStarts |
已淘汰.
|
| BindExternalServiceLong |
其運作方式與 相同 |
| BindNotPerceptible |
已淘汰.
旗標: |
| BindPackageIsolatedProcess |
已淘汰.
標記 |
| BindSharedIsolatedProcess |
已淘汰.
旗標: |
| BiometricService |
使用 來 |
| BlobStoreService |
使用 搭配 |
| BluetoothService |
使用 搭配 |
| BugreportService |
擷取 Bugreport 的服務。 (繼承來源 Context) |
| CameraService |
使用 來 |
| CaptioningService |
使用 搭配 |
| CarrierConfigService |
使用 搭配 |
| ChooserService |
使用 搭配 |
| ClipboardService |
使用搭配 |
| CompanionDeviceService |
使用搭配 |
| ConnectivityDiagnosticsService |
使用 搭配 |
| ConnectivityService |
使用搭配 |
| ConsumerIrService |
使用 搭配 |
| ContactKeysService |
使用來 |
| CredentialService |
使用搭配 |
| CrossProfileAppsService |
使用 搭配 |
| DeviceIdDefault |
默認裝置識別碼,這是主要(非虛擬)裝置的標識碼。 (繼承來源 Context) |
| DeviceIdInvalid |
無效的裝置識別碼。 (繼承來源 Context) |
| DeviceLockService |
使用 搭配 |
| DevicePolicyService |
使用 搭配 |
| DisplayHashService |
使用搭配 |
| DisplayService |
使用 來 |
| DomainVerificationService |
使用搭配 |
| DownloadService |
使用 搭配 |
| DropboxService |
使用搭配 |
| EuiccService |
使用搭配 |
| FileIntegrityService |
使用 搭配 |
| FingerprintService |
使用搭配 |
| GameService |
使用 搭配 |
| GrammaticalInflectionService |
使用 搭配 |
| HardwarePropertiesService |
使用搭配 |
| HealthconnectService |
使用 搭配 |
| InputMethodService |
使用搭配 |
| InputService |
使用 來 |
| IpsecService |
使用 搭配 |
| JobSchedulerService |
使用 搭配 |
| KeyguardService |
使用 搭配 |
| KeystoreService |
使用 with |
| LauncherAppsService |
使用 搭配 |
| LayoutInflaterService |
使用 搭配 |
| LocaleService |
使用 搭配 |
| LocationService |
使用 搭配 |
| MediaCommunicationService |
使用搭配 |
| MediaMetricsService |
使用 來 |
| MediaProjectionService |
使用 搭配 |
| MediaQualityService |
使用 with |
| MediaRouterService |
使用 搭配 |
| MediaSessionService |
使用搭配 |
| MidiService |
使用 搭配 |
| NetworkStatsService |
使用搭配 |
| NfcService |
使用 搭配 |
| NotificationService |
使用 搭配 |
| NsdService |
使用搭配 |
| OverlayService |
使用 搭配 |
| PeopleService |
使用 來 |
| PerformanceHintService |
使用 搭配 |
| PersistentDataBlockService |
用 來 |
| PowerService |
使用 搭配 |
| PrintService |
|
| ProfilingService |
使用 搭配 |
| ReceiverExported |
已淘汰.
旗標 |
| ReceiverNotExported |
已淘汰.
旗標: |
| ReceiverVisibleToInstantApps |
已淘汰.
旗標: |
| RestrictionsService |
使用 搭配 |
| RoleService |
使用搭配 |
| SatelliteService |
使用 with |
| SearchService |
使用 搭配 |
| SecurityStateService |
使用 with |
| SensorService |
使用 搭配 |
| ShortcutService |
使用搭配 |
| StatusBarService |
使用 來 |
| StorageService |
使用搭配 |
| StorageStatsService |
使用搭配 |
| SystemHealthService |
使用 搭配 |
| TelecomService |
使用搭配 |
| TelephonyImsService |
使用 搭配 |
| TelephonyPhoneNumberService |
使用 with |
| TelephonyService |
使用 搭配 |
| TelephonySubscriptionService |
使用 搭配 |
| TetheringService |
使用 with |
| TextClassificationService |
使用 搭配 |
| TextServicesManagerService |
使用搭配 |
| TvAdService |
使用 with |
| TvInputService |
使用 來 |
| TvInteractiveAppService |
使用 搭配 |
| UiModeService |
使用 搭配 |
| UsageStatsService |
使用搭配 |
| UsbService |
使用 搭配 |
| UserService |
使用 搭配 |
| VibratorManagerService |
使用 搭配 |
| VibratorService |
使用 搭配 |
| VirtualDeviceService |
使用搭配 |
| VpnManagementService |
使用搭配 |
| WallpaperService |
使用 搭配 |
| WifiAwareService |
使用 搭配 |
| WifiP2pService |
使用 搭配 |
| WifiRttRangingService |
使用 搭配 |
| WifiService |
使用 搭配 |
| WindowService |
使用 搭配 |
屬性
| 名稱 | Description |
|---|---|
| ApplicationContext |
傳回目前進程之單一全域 Application 對象的內容。 (繼承來源 ContextWrapper) |
| ApplicationInfo |
傳回此內容套件的完整應用程式資訊。 (繼承來源 ContextWrapper) |
| Assets |
傳回應用程式套件的 AssetManager 實例。 (繼承來源 ContextWrapper) |
| AttributionSource |
取得與此情境相關的歸屬來源。 (繼承來源 Context) |
| AttributionTag |
屬性可用於複雜的應用程式中,以邏輯方式分隔應用程式的部分。 (繼承來源 Context) |
| BaseContext | (繼承來源 ContextWrapper) |
| CacheDir |
傳回檔案系統上應用程式特定快取目錄的絕對路徑。 (繼承來源 ContextWrapper) |
| Class |
傳回這個 |
| ClassLoader |
傳回類別載入器,您可用來擷取此封裝中的類別。 (繼承來源 ContextWrapper) |
| CodeCacheDir |
傳回檔案系統上應用程式特定快取目錄的絕對路徑,該目錄是專為儲存快取的程式代碼所設計。 (繼承來源 ContextWrapper) |
| ContentResolver |
傳回應用程式套件的 ContentResolver 實例。 (繼承來源 ContextWrapper) |
| Context |
維護全域應用程式狀態的基類。 |
| DataDir |
回傳檔案系統中存放所有屬於此應用程式的私有檔案的目錄的絕對路徑。 應用程式不應直接使用此路徑;他們應該改用 getFilesDir() 、getCacheDir() 、getDir(String,int) 或其他儲存 API 來處理這個類別。 若呼叫應用程式移至已採用的儲存裝置,回傳路徑可能會隨時間改變,因此僅應保留相對路徑。 呼叫應用程式在回傳路徑下讀寫檔案不需要額外權限。 退稅檔案 (繼承來源 ContextWrapper) |
| DeviceId |
取得此內容相關聯的裝置標識碼。 (繼承來源 Context) |
| Display |
取得與此內容相關聯的顯示。 (繼承來源 Context) |
| ExternalCacheDir |
傳回主要外部檔案系統上目錄的絕對路徑(也就是 ExternalStorageDirectory 應用程式可以放置其擁有之快取檔案的位置。 (繼承來源 ContextWrapper) |
| FilesDir |
傳回檔系統上用來儲存檔案 OpenFileOutput(String, FileCreationMode) 的目錄絕對路徑。 (繼承來源 ContextWrapper) |
| Handle |
基礎Android實例的句柄。 (繼承來源 Object) |
| IsDeviceProtectedStorage |
表示此上下文的儲存 API 是否由裝置保護儲存所支援。 (繼承來源 ContextWrapper) |
| IsRestricted |
指出此內容是否受到限制。 (繼承來源 Context) |
| IsUiContext |
如果內容是可存取、 或 |
| JniIdentityHashCode |
取得由互通執行時指派給此 Java 對等端的身份雜湊碼。 (繼承來源 Object) |
| JniManagedPeerState |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| JniPeerMembers |
提供 Android.App.Application 的 JNI 綁定基礎設施。 |
| MainExecutor |
|
| MainLooper |
傳回目前進程之主線程的迴圈器。 (繼承來源 ContextWrapper) |
| NoBackupFilesDir |
傳回檔案系統上目錄的絕對路徑,類似於 FilesDir。 (繼承來源 ContextWrapper) |
| ObbDir |
傳回此應用程式 OBB 檔案(如果有的話)可找到的主要外部記憶體目錄。 (繼承來源 ContextWrapper) |
| OpPackageName |
傳回應該用於 |
| PackageCodePath |
傳回此內容主要 Android 套件的完整路徑。 (繼承來源 ContextWrapper) |
| PackageManager |
傳回 PackageManager 實例以尋找全域套件資訊。 (繼承來源 ContextWrapper) |
| PackageName |
傳回此應用程式套件的名稱。 (繼承來源 ContextWrapper) |
| PackageResourcePath |
傳回此內容主要 Android 套件的完整路徑。 (繼承來源 ContextWrapper) |
| Params |
如果透過 建立此內容,則傳回此內容所建立 |
| PeerReference |
取得這個 Java 節點的 JNI 物件參考。 (繼承來源 Object) |
| ProcessName |
傳回目前進程的名稱。 |
| Resources |
傳回應用程式套件的 Resources 實例。 (繼承來源 ContextWrapper) |
| SynchronizationContext |
維護全域應用程式狀態的基類。 |
| Theme |
傳回與此內容相關聯的 Theme 物件。 (繼承來源 ContextWrapper) |
| ThresholdClass |
提供 Android.App.Application 的 JNI 綁定基礎設施。 |
| ThresholdType |
提供 Android.App.Application 的 JNI 綁定基礎設施。 |
| Wallpaper | (繼承來源 ContextWrapper) |
| WallpaperDesiredMinimumHeight | (繼承來源 ContextWrapper) |
| WallpaperDesiredMinimumWidth | (繼承來源 ContextWrapper) |
方法
| 名稱 | Description |
|---|---|
| AttachBaseContext(Context) |
設定此 ContextWrapper 的基底內容。 (繼承來源 ContextWrapper) |
| BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection) |
請參考 bindIsolatedService(Intent, int, String, Executor, ServiceConnection) 呼叫 BindServiceFlags.of(long) 以取得 BindServiceFlags 物件。 (繼承來源 Context) |
| BindIsolatedService(Intent, Int32, String, IExecutor, IServiceConnection) |
在孤立服務的特定情況下,這種變化 |
| BindService(Intent, Bind, IExecutor, IServiceConnection) |
與 |
| BindService(Intent, Context+BindServiceFlags, IExecutor, IServiceConnection) |
請參見 bindService(Intent, int, Executor, ServiceConnection) 呼叫 BindServiceFlags.of(long) 以取得 BindServiceFlags 物件。 (繼承來源 Context) |
| BindService(Intent, IServiceConnection, Bind) |
線上到應用程式服務,並視需要加以建立。 (繼承來源 ContextWrapper) |
| BindService(Intent, IServiceConnection, Context+BindServiceFlags) |
請參見 bindService(Intent, ServiceConnection, int) 呼叫 BindServiceFlags.of(long) 以取得 BindServiceFlags 物件。 (繼承來源 Context) |
| BindServiceAsUser(Intent, IServiceConnection, Context+BindServiceFlags, UserHandle) |
請參考 bindServiceAsUser(Intent, ServiceConnection, int, UserHandle) 呼叫 BindServiceFlags.of(long) 以取得 BindServiceFlags 物件。 (繼承來源 Context) |
| BindServiceAsUser(Intent, IServiceConnection, Int32, UserHandle) |
以與 相同的方式 |
| CheckCallingOrSelfPermission(String) |
判斷 IPC 的呼叫程式,還是您已 獲得特定許可權。 (繼承來源 ContextWrapper) |
| CheckCallingOrSelfUriPermission(Uri, ActivityFlags) |
判斷 IPC 的呼叫程式,還是您已 獲得存取特定 URI 的許可權。 (繼承來源 ContextWrapper) |
| CheckCallingOrSelfUriPermissions(IList<Uri>, Int32) |
判斷 IPC <em> 或 you</em> 的呼叫程式是否已獲得存取 URI 清單的許可權。 (繼承來源 Context) |
| CheckCallingPermission(String) |
判斷您正在處理的 IPC 呼叫進程是否已獲得特定許可權。 (繼承來源 ContextWrapper) |
| CheckCallingUriPermission(Uri, ActivityFlags) |
判斷呼叫進程和使用者標識碼是否已獲得存取特定 URI 的許可權。 (繼承來源 ContextWrapper) |
| CheckCallingUriPermissions(IList<Uri>, Int32) |
確認呼叫程序與 UID 是否已獲得存取 URI 清單的權限。 (繼承來源 Context) |
| CheckContentUriPermissionFull(Uri, Int32, Int32, ActivityFlags) |
確認某個程序和 UID 是否已被授權存取特定內容 URI。 (繼承來源 Context) |
| CheckPermission(String, Int32, Int32) |
判斷特定進程是否允許指定的許可權,以及系統中執行的使用者識別碼。 (繼承來源 ContextWrapper) |
| CheckSelfPermission(String) |
確認您是否已獲得特定許可。 (繼承來源 ContextWrapper) |
| CheckUriPermission(Uri, Int32, Int32, ActivityFlags) |
判斷特定進程和使用者識別碼是否已獲得存取特定 URI 的許可權。 (繼承來源 ContextWrapper) |
| CheckUriPermission(Uri, String, String, Int32, Int32, ActivityFlags) |
檢查 URI 和一般許可權。 (繼承來源 ContextWrapper) |
| CheckUriPermissions(IList<Uri>, Int32, Int32, Int32) |
確認某個程序與 UID 是否已被授權存取 URI 清單。 (繼承來源 Context) |
| ClearWallpaper() |
已淘汰.
(繼承來源 ContextWrapper)
|
| Clone() |
建立並傳回這個 對象的複本。 (繼承來源 Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| CreateAttributionContext(String) |
傳回目前 Context 的新 Context 物件,但將 屬性傳回至不同的標記。 (繼承來源 Context) |
| CreateConfigurationContext(Configuration) |
傳回目前 Context 的新 Context 物件,但是其資源已調整以符合指定的組態。 (繼承來源 ContextWrapper) |
| CreateContext(ContextParams) |
建立具有特定屬性和行為的內容。 (繼承來源 Context) |
| CreateContextForSplit(String) |
為該分割名稱回傳一個新的 Context 物件。 新的 Context 有一個 ClassLoader 和 Resources 物件,可以存取分割及其所有相依關係的程式碼/資源。 每次呼叫此方法都會回傳一個新的上下文物件實例;上下文物件不會被共享,但共用狀態(如 ClassLoader 或其他資源)可能會共享,因此上下文本身可以相當輕量。 (繼承來源 ContextWrapper) |
| CreateDeviceContext(Int32) |
從目前內容傳回新的 |
| CreateDeviceProtectedStorageContext() |
回傳一個新的上下文物件,用於目前上下文,但其儲存 API 由裝置保護儲存所支援。 在具備直接開機功能的裝置上,儲存在該位置的資料會以綁定於實體裝置的金鑰加密,且在裝置成功開機後,使用者使用憑證(如鎖定模式或 PIN 碼)驗證之前及之後,都能立即存取資料。 由於裝置保護的資料在無需使用者驗證的情況下即可取得,您應謹慎限制使用此上下文儲存的資料。 例如,強烈建議在裝置保護區域儲存敏感的認證憑證或密碼。 若底層裝置無法使用不同金鑰儲存裝置保護與憑證保護的資料,則兩個儲存區域將同時開放。 它們仍作為磁碟上的兩個獨立儲存位置,只有可用性視窗會改變。 每次呼叫此方法都會回傳一個新的上下文物件實例;上下文物件不會共享,但共用狀態(如 ClassLoader、同一配置的其他資源)可能會共享,因此上下文本身可以相當輕量。 退稅資料背景 (繼承來源 ContextWrapper) |
| CreateDisplayContext(Display) |
傳回目前 Context 的新 Context 物件,但是其資源會調整以符合指定 Display 的計量。 (繼承來源 ContextWrapper) |
| CreatePackageContext(String, PackageContextFlags) |
傳回指定應用程式名稱的新 Context 物件。 (繼承來源 ContextWrapper) |
| CreateWindowContext(Display, Int32, Bundle) |
|
| CreateWindowContext(Int32, Bundle) |
建立非活動窗口的內容。 (繼承來源 Context) |
| DatabaseList() |
傳回字串數位,此字串會命名與此內容應用程式封裝相關聯的私用資料庫。 (繼承來源 ContextWrapper) |
| DeleteDatabase(String) |
刪除與此內容應用程式套件相關聯的現有私人 SQLiteDatabase。 (繼承來源 ContextWrapper) |
| DeleteFile(String) |
刪除與此內容應用程式套件相關聯的指定私人檔案。 (繼承來源 ContextWrapper) |
| DeleteSharedPreferences(String) |
刪除一個現有的共享偏好設定檔案。 (繼承來源 ContextWrapper) |
| Dispose() |
釋放該 Java 節點所持有的資源。 (繼承來源 Object) |
| Dispose(Boolean) |
釋放該 Java 節點所持有的資源。 (繼承來源 Object) |
| DisposeUnlessReferenced() |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| EnforceCallingOrSelfPermission(String, String) |
如果您或 IPC 的呼叫行程都未獲授與特定許可權,則擲回 SecurityException。 (繼承來源 ContextWrapper) |
| EnforceCallingOrSelfUriPermission(Uri, ActivityFlags, String) |
如果 IPC 的呼叫行程或您 尚未獲授與存取特定 URI 的許可權,請擲回 SecurityException。 (繼承來源 ContextWrapper) |
| EnforceCallingPermission(String, String) |
如果您處理的 IPC 呼叫行程尚未獲得特定權限,則擲回 SecurityException。 (繼承來源 ContextWrapper) |
| EnforceCallingUriPermission(Uri, ActivityFlags, String) |
如果呼叫行程和使用者識別碼尚未獲授與存取特定 URI 的許可權,則擲回 SecurityException。 (繼承來源 ContextWrapper) |
| EnforcePermission(String, Int32, Int32, String) |
如果系統執行的特定行程和使用者識別碼不允許指定的許可權,則擲回 SecurityException。 (繼承來源 ContextWrapper) |
| EnforceUriPermission(Uri, Int32, Int32, ActivityFlags, String) |
如果特定行程與使用者識別碼尚未獲授與存取特定 URI 的許可權,則擲回 SecurityException。 (繼承來源 ContextWrapper) |
| EnforceUriPermission(Uri, String, String, Int32, Int32, ActivityFlags, String) |
強制執行 URI 和一般許可權。 (繼承來源 ContextWrapper) |
| Equals(Object) |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| Equals(Object) |
指出其他物件是否「等於」這個物件。 (繼承來源 Object) |
| FileList() |
傳回字串數位,此字串會命名與此內容的應用程式套件相關聯的私用檔案。 (繼承來源 ContextWrapper) |
| GetColor(Int32) |
傳回與特定資源標識符相關聯的色彩,並針對目前主題設定樣式。 (繼承來源 Context) |
| GetColorStateList(Int32) |
傳回與特定資源標識符相關聯的色彩狀態清單,並針對目前主題設定樣式。 (繼承來源 Context) |
| GetDatabasePath(String) |
回傳檔案系統中以 openOrCreateDatabase(String, int, CursorFactory) 建立資料庫的絕對路徑。 若呼叫應用程式移至已採用的儲存裝置,回傳路徑可能會隨時間改變,因此僅應保留相對路徑。 (繼承來源 ContextWrapper) |
| GetDir(String, FileCreationMode) |
視需要擷取、建立新的目錄,讓應用程式可以放置自己的自定義數據檔。 (繼承來源 ContextWrapper) |
| GetDrawable(Int32) |
傳回與特定資源標識符相關聯的可繪製物件,並針對目前主題設定樣式。 (繼承來源 Context) |
| GetExternalCacheDirs() |
傳回應用程式可放置其擁有之快取檔案之所有外部儲存設備上應用程式特定目錄的絕對路徑。 (繼承來源 ContextWrapper) |
| GetExternalFilesDir(String) |
傳回主要外部文件系統上目錄的絕對路徑(位於 某 ExternalStorageDirectory處),應用程式可以在其中放置它所擁有的永續性檔案。 (繼承來源 ContextWrapper) |
| GetExternalFilesDirs(String) |
傳回應用程式所有外部儲存裝置上應用程式特定目錄的絕對路徑,其中應用程式可以放置它所擁有的永續性檔案。 (繼承來源 ContextWrapper) |
| GetExternalMediaDirs() |
已淘汰.
傳回應用程式可放置媒體檔案之所有外部存放裝置上應用程式特定目錄的絕對路徑。 (繼承來源 ContextWrapper) |
| GetFileStreamPath(String) |
傳回使用 所建立 OpenFileOutput(String, FileCreationMode) 檔案之文件系統上的絕對路徑。 (繼承來源 ContextWrapper) |
| GetHashCode() |
傳回此物件的雜湊碼值。 (繼承來源 Object) |
| GetObbDirs() |
傳回應用程式所有外部存放設備上應用程式特定目錄的絕對路徑,其中可以找到應用程式的 OBB 檔案(如果有的話)。 (繼承來源 ContextWrapper) |
| GetSharedPreferences(String, FileCreationMode) |
擷取並保存喜好設定檔 『name』 的內容,並傳回 SharedPreferences,您可以透過此檔案擷取和修改其值。 (繼承來源 ContextWrapper) |
| GetString(Int32, Object[]) |
從應用程式封裝的預設字串數據表傳回本地化的字串。 (繼承來源 Context) |
| GetString(Int32) |
從應用程式封裝的預設字串數據表傳回本地化的字串。 (繼承來源 Context) |
| GetSystemService(Class) |
依類別將句柄傳回至系統層級服務。 (繼承來源 Context) |
| GetSystemService(String) |
依名稱將句柄傳回至系統層級服務。 (繼承來源 ContextWrapper) |
| GetSystemServiceName(Class) |
取得由指定類別所代表的系統層級服務名稱。 (繼承來源 ContextWrapper) |
| GetText(Int32) |
從應用程式套件的預設字串數據表傳回本地化樣式的 CharSequence。 (繼承來源 Context) |
| GetTextFormatted(Int32) |
從應用程式套件的預設字串數據表傳回本地化樣式的 CharSequence。 (繼承來源 Context) |
| GrantUriPermission(String, Uri, ActivityFlags) |
不論該套件是否具有存取 Uri 內容提供者的一般許可權,授與存取特定 URI 的許可權給另一個套件。 (繼承來源 ContextWrapper) |
| JavaFinalize() |
當垃圾收集決定不再參考物件時,垃圾收集行程在 物件上呼叫。 (繼承來源 Object) |
| MoveDatabaseFrom(Context, String) |
將現有的資料庫檔案從給定的來源儲存上下文移動到這個上下文。 這通常用於升級後的資料在儲存位置間的遷移,例如遷移到裝置保護儲存裝置。 資料庫必須關閉後才能移動。 (繼承來源 ContextWrapper) |
| MoveSharedPreferencesFrom(Context, String) |
將現有的共享偏好設定檔案從給定的來源儲存上下文移到這個上下文。 這通常用於升級後的資料在儲存位置間的遷移,例如移動到裝置保護儲存裝置。 (繼承來源 ContextWrapper) |
| Notify() |
喚醒正在等候此物件監視器的單一線程。 (繼承來源 Object) |
| NotifyAll() |
喚醒正在等候此物件監視器的所有線程。 (繼承來源 Object) |
| ObtainStyledAttributes(IAttributeSet, Int32[], Int32, Int32) |
擷取此內容主題中的樣式屬性資訊。 (繼承來源 Context) |
| ObtainStyledAttributes(IAttributeSet, Int32[]) |
擷取此內容主題中的樣式屬性資訊。 (繼承來源 Context) |
| ObtainStyledAttributes(Int32, Int32[]) |
擷取此內容主題中的樣式屬性資訊。 (繼承來源 Context) |
| ObtainStyledAttributes(Int32[]) |
擷取此內容主題中的樣式屬性資訊。 (繼承來源 Context) |
| OnConfigurationChanged(Configuration) |
當元件執行時裝置組態變更時,由系統呼叫。 |
| OnCreate() |
在應用程式啟動時呼叫,在建立任何活動、服務或接收者物件之前(不包括內容提供者)。 |
| OnLowMemory() |
當整體系統在記憶體不足時呼叫,且主動執行的進程應該會修剪其記憶體使用量。 |
| OnTerminate() |
這個方法可用於仿真的進程環境中。 |
| OnTrimMemory(TrimMemory) |
當作業系統判斷行程從其行程修剪不需要的記憶體時,就會呼叫 。 |
| OpenFileInput(String) |
開啟與此內容應用程式套件相關聯的私人檔案以供讀取。 (繼承來源 ContextWrapper) |
| OpenFileOutput(String, FileCreationMode) |
開啟與此內容應用程式套件相關聯的私人檔案以進行寫入。 (繼承來源 ContextWrapper) |
| OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler) |
開啟與此內容應用程式套件相關聯的新私人 SQLiteDatabase。 (繼承來源 ContextWrapper) |
| OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory) |
開啟與此內容應用程式套件相關聯的新私人 SQLiteDatabase。 (繼承來源 ContextWrapper) |
| PeekWallpaper() |
已淘汰.
(繼承來源 ContextWrapper)
|
| RegisterActivityLifecycleCallbacks(Application+IActivityLifecycleCallbacks) |
維護全域應用程式狀態的基類。 |
| RegisterComponentCallbacks(IComponentCallbacks) |
將新的 |
| RegisterDeviceIdChangeListener(IExecutor, IIntConsumer) |
將新的裝置識別碼變更接聽程式新增至 |
| RegisterOnProvideAssistDataListener(Application+IOnProvideAssistDataListener) |
維護全域應用程式狀態的基類。 |
| RegisterReceiver(BroadcastReceiver, IntentFilter, ActivityFlags) |
已淘汰.
註冊以接收意圖廣播,接收端可選擇性地暴露給即時應用程式。 更多資訊請參閱 registerReceiver(BroadcastReceiver, IntentFilter)。 預設情況下,即時應用程式無法與其他應用程式中的接收器互動,這讓你可以公開一個接收器,讓即時應用程式能互動。 欲了解更多意圖廣播資訊,請參閱 BroadcastReceiver。 截至Build.VERSION_CODES年。UPSIDE_DOWN_CAKE ,系統可在應用程式處於快取狀態時,將上下文註冊的廣播放入佇列。 當應用程式離開快取狀態,例如回到前景時,系統會傳送所有排隊的廣播。 某些廣播的多個實例可能會合併成一個廣播。 截至Build.VERSION_CODES年。ICE_CREAM_SANDWICH,使用此方法註冊的接收器會正確遵守廣播意圖所指定的 Intent.setPackage(字串)。 在此之前,這份郵件會被忽略,並送達所有匹配的註冊收件人。 使用這些資料時要小心。 參數接收器 BroadcastReceiver:此值可能為空值。 (繼承來源 ContextWrapper) |
| RegisterReceiver(BroadcastReceiver, IntentFilter, ReceiverFlags) |
註冊以接收意圖廣播,接收端可選擇性地暴露給即時應用程式。 更多資訊請參閱 registerReceiver(BroadcastReceiver, IntentFilter)。 預設情況下,即時應用程式無法與其他應用程式中的接收器互動,這讓你可以公開一個接收器,讓即時應用程式能互動。 欲了解更多意圖廣播資訊,請參閱 BroadcastReceiver。 截至Build.VERSION_CODES年。UPSIDE_DOWN_CAKE ,系統可在應用程式處於快取狀態時,將上下文註冊的廣播放入佇列。 當應用程式離開快取狀態,例如回到前景時,系統會傳送所有排隊的廣播。 某些廣播的多個實例可能會合併成一個廣播。 截至Build.VERSION_CODES年。ICE_CREAM_SANDWICH,使用此方法註冊的接收器會正確遵守廣播意圖所指定的 Intent.setPackage(字串)。 在此之前,這份郵件會被忽略,並送達所有匹配的註冊收件人。 使用這些資料時要小心。 參數接收器 BroadcastReceiver:負責處理廣播的 BroadcastReceiver。 此值可能是零值。 (繼承來源 Context) |
| RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler, ActivityFlags) |
已淘汰.
註冊以接收意圖廣播,以便在排程器情境下執行。 更多資訊請參見 registerReceiver(BroadcastReceiver,IntentFilter,整數)與 registerReceiver(BroadcastReceiver,IntentFilter,String,Handler)。 欲了解更多意圖廣播資訊,請參閱 BroadcastReceiver。 截至Build.VERSION_CODES年。UPSIDE_DOWN_CAKE ,系統可在應用程式處於快取狀態時,將上下文註冊的廣播放入佇列。 當應用程式離開快取狀態,例如回到前景時,系統會傳送所有排隊的廣播。 某些廣播的多個實例可能會合併成一個廣播。 截至Build.VERSION_CODES年。ICE_CREAM_SANDWICH,使用此方法註冊的接收器會正確遵守廣播意圖所指定的 Intent.setPackage(字串)。 在此之前,這份郵件會被忽略,並送達所有匹配的註冊收件人。 使用這些資料時要小心。 參數接收器 BroadcastReceiver:此值可能為空值。 (繼承來源 ContextWrapper) |
| RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler, ReceiverFlags) |
註冊以接收意圖廣播,以便在排程器情境下執行。 更多資訊請參見 registerReceiver(BroadcastReceiver,IntentFilter,整數)與 registerReceiver(BroadcastReceiver,IntentFilter,String,Handler)。 欲了解更多意圖廣播資訊,請參閱 BroadcastReceiver。 截至Build.VERSION_CODES年。UPSIDE_DOWN_CAKE ,系統可在應用程式處於快取狀態時,將上下文註冊的廣播放入佇列。 當應用程式離開快取狀態,例如回到前景時,系統會傳送所有排隊的廣播。 某些廣播的多個實例可能會合併成一個廣播。 截至Build.VERSION_CODES年。ICE_CREAM_SANDWICH,使用此方法註冊的接收器會正確遵守廣播意圖所指定的 Intent.setPackage(字串)。 在此之前,這份郵件會被忽略,並送達所有匹配的註冊收件人。 使用這些資料時要小心。 參數接收器 BroadcastReceiver:負責處理廣播的 BroadcastReceiver。 (繼承來源 Context) |
| RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler) |
註冊以接收意圖廣播,並在 var<排程器>/var< 的情境>下執行。 (繼承來源 ContextWrapper) |
| RegisterReceiver(BroadcastReceiver, IntentFilter) |
註冊在主要活動線程中執行的 BroadcastReceiver。 (繼承來源 ContextWrapper) |
| RemoveStickyBroadcast(Intent) |
已淘汰.
(繼承來源 ContextWrapper)
|
| RemoveStickyBroadcastAsUser(Intent, UserHandle) |
已淘汰.
(繼承來源 ContextWrapper)
|
| RevokeSelfPermissionOnKill(String) |
觸發運行時間許可權的異步撤銷。 (繼承來源 Context) |
| RevokeSelfPermissionsOnKill(ICollection<String>) |
觸發呼叫套件的一或多個許可權撤銷。 (繼承來源 Context) |
| RevokeUriPermission(String, Uri, ActivityFlags) |
移除先前以 grantUriPermission(String, Uri, int) 為特定目標套件新增的存取特定內容提供者 Uri 的權限。 給定的 Uri 會匹配所有先前獲得且相同或屬於該 Uri 子路徑的 Uri。 也就是說,撤銷「content://foo/target」會同時撤銷「content://foo/target」和「content://foo/target/sub」,但不會撤銷「content://foo」。 它不會移除任何存在於更高層級的前綴補助金。 與 revokeUriPermission(Uri,int) 不同,此方法僅會撤銷透過 grantUriPermission(String, Uri, int) 明確授予的權限,且僅限於指定的套件。 任何透過其他機制(剪貼簿、活動啟動、服務啟動等)達成的配對補助金都不會被移除。 (繼承來源 ContextWrapper) |
| RevokeUriPermission(Uri, ActivityFlags) |
拿掉所有許可權,以存取先前以 M:Android.Content.Context.GrantUriPermission(System.String,Android.Net.Uri,Android.Net.Uri,Android.Net.Uri)新增的特定內容提供者 URI。 (繼承來源 ContextWrapper) |
| SendBroadcast(Intent, String, Bundle) |
將指定意圖廣播給所有感興趣的 BroadcastReceivers,允許強制執行選擇性的必要許可權。 (繼承來源 Context) |
| SendBroadcast(Intent, String) |
將指定意圖廣播給所有感興趣的 BroadcastReceivers,允許強制執行選擇性的必要許可權。 (繼承來源 ContextWrapper) |
| SendBroadcast(Intent) |
將指定意圖廣播給所有感興趣的 BroadcastReceivers。 (繼承來源 ContextWrapper) |
| SendBroadcastAsUser(Intent, UserHandle, String) |
SendBroadcast(Intent, String)版本,可讓您指定將傳送廣播的使用者。 (繼承來源 ContextWrapper) |
| SendBroadcastAsUser(Intent, UserHandle) |
SendBroadcast(Intent)版本,可讓您指定將傳送廣播的使用者。 (繼承來源 ContextWrapper) |
| SendBroadcastWithMultiplePermissions(Intent, String[]) |
將指定意圖廣播給所有感興趣的 BroadcastReceivers,允許強制執行必要的許可權數位。 (繼承來源 Context) |
| SendOrderedBroadcast(Intent, Int32, String, String, BroadcastReceiver, Handler, String, Bundle, Bundle) |
依序向有興趣的接收者廣播意圖。 (繼承來源 ContextWrapper) |
| SendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, Result, String, Bundle) |
SendBroadcast(Intent)版本可讓您從廣播中接收數據。 (繼承來源 ContextWrapper) |
| SendOrderedBroadcast(Intent, String, Bundle, BroadcastReceiver, Handler, Result, String, Bundle) |
|
| SendOrderedBroadcast(Intent, String, Bundle) |
將指定意圖廣播給所有感興趣的 BroadcastReceivers,一次傳遞一個,以允許更偏好的接收者在傳遞給較不慣用的接收者之前取用廣播。 (繼承來源 Context) |
| SendOrderedBroadcast(Intent, String, String, BroadcastReceiver, Handler, Result, String, Bundle) |
|
| SendOrderedBroadcast(Intent, String) |
將指定意圖廣播給所有感興趣的 BroadcastReceivers,一次傳遞一個,以允許更偏好的接收者在傳遞給較不慣用的接收者之前取用廣播。 此呼叫為非同步;它會立即回傳,並在接收器運行時繼續執行。 欲了解更多意圖廣播資訊,請參閱 BroadcastReceiver。 (繼承來源 ContextWrapper) |
| SendOrderedBroadcastAsUser(Intent, UserHandle, String, BroadcastReceiver, Handler, Result, String, Bundle) |
sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle) 的版本,允許你指定廣播將傳送給哪個使用者。 此功能不適用於未預先安裝於系統映像中的應用程式。 欲了解更多意圖廣播資訊,請參閱 BroadcastReceiver。 需要 Android。Manifest.permission.INTERACT_ACROSS_USERS (繼承來源 ContextWrapper) |
| SendStickyBroadcast(Intent, Bundle) |
|
| SendStickyBroadcast(Intent) |
已淘汰.
|
| SendStickyBroadcastAsUser(Intent, UserHandle) |
已淘汰.
(繼承來源 ContextWrapper)
|
| SendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, Result, String, Bundle) |
已淘汰.
(繼承來源 ContextWrapper)
|
| SendStickyOrderedBroadcastAsUser(Intent, UserHandle, BroadcastReceiver, Handler, Result, String, Bundle) |
已淘汰.
(繼承來源 ContextWrapper)
|
| SetHandle(IntPtr, JniHandleOwnership) |
設定 Handle 屬性。 (繼承來源 Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| SetTheme(Int32) |
設定此內容的基底主題。 (繼承來源 ContextWrapper) |
| SetWallpaper(Bitmap) |
已淘汰.
(繼承來源 ContextWrapper)
|
| SetWallpaper(Stream) |
已淘汰.
(繼承來源 ContextWrapper)
|
| StartActivities(Intent[], Bundle) |
啟動多個新活動。 (繼承來源 ContextWrapper) |
| StartActivities(Intent[]) |
與 StartActivities(Intent[], Bundle) 未指定任何選項相同。 (繼承來源 ContextWrapper) |
| StartActivity(Intent, Bundle) |
啟動新的活動。 (繼承來源 ContextWrapper) |
| StartActivity(Intent) |
與 StartActivity(Intent, Bundle) 未指定任何選項相同。 (繼承來源 ContextWrapper) |
| StartActivity(Type) |
跟 startActivity(Intent, Bundle) 一樣,但沒有指定選項。 (繼承來源 Context) |
| StartForegroundService(Intent) |
類似於 startService(Intent) ,但隱含承諾服務一旦開始執行就會呼叫 startForeground(int, android.app.Notification)。 服務會獲得相當於 ANR 間隔的時間來完成此事,否則系統會自動當機,屆時執行 SDK 版本 Build.VERSION_CODES 的裝置會記錄內部異常 ForegroundServiceDidNotStartInTimeException。S或更晚。 在較舊的 Android 版本中,會記錄一個內部例外 RemoteServiceException,並附有相應訊息。 與一般的 startService(Intent) 不同,此方法可隨時使用,無論服務的應用程式是否處於前景狀態。 注意:從 SDK 版本 Build.VERSION_CODES 開始。S,針對 SDK 版本 Build.VERSION_CODES 的應用程式。S 級以上的用戶不得從背景啟動前景服務。 詳情請參見行為變更:針對 Android 12 的應用程式。 (繼承來源 ContextWrapper) |
| StartInstrumentation(ComponentName, String, Bundle) |
開始執行類別 Instrumentation 。 (繼承來源 ContextWrapper) |
| StartIntentSender(IntentSender, Intent, ActivityFlags, ActivityFlags, Int32, Bundle) |
就像 StartActivity(Intent, Bundle),但要開始使用 IntentSender。 (繼承來源 ContextWrapper) |
| StartIntentSender(IntentSender, Intent, ActivityFlags, ActivityFlags, Int32) |
與 startIntentSender(IntentSender, Intent, int, int, int, Bundle) 相同,但未指定任何選項。 (繼承來源 ContextWrapper) |
| StartService(Intent) |
要求啟動指定的應用程式服務。 (繼承來源 ContextWrapper) |
| StopService(Intent) |
要求停止指定的應用程式服務。 (繼承來源 ContextWrapper) |
| ToArray<T>() |
從這個 Java 陣列包裝器建立一個受管理陣列。 (繼承來源 Object) |
| ToString() |
傳回物件的字串表示。 (繼承來源 Object) |
| UnbindService(IServiceConnection) |
中斷與應用程式服務的連線。 (繼承來源 ContextWrapper) |
| UnregisterActivityLifecycleCallbacks(Application+IActivityLifecycleCallbacks) |
維護全域應用程式狀態的基類。 |
| UnregisterComponentCallbacks(IComponentCallbacks) |
|
| UnregisterDeviceIdChangeListener(IIntConsumer) |
從內容中移除已變更的裝置標識碼接聽程式。 (繼承來源 Context) |
| UnregisterFromRuntime() |
將此 Java 節點從互通執行時中取消註冊。 (繼承來源 Object) |
| UnregisterOnProvideAssistDataListener(Application+IOnProvideAssistDataListener) |
本頁內容與程式碼範例受內容授權條款所規範。 |
| UnregisterReceiver(BroadcastReceiver) |
取消註冊先前註冊的 BroadcastReceiver。 (繼承來源 ContextWrapper) |
| UpdateServiceGroup(IServiceConnection, Int32, Int32) |
針對先前系結的服務 |
| Wait() |
讓目前線程等候直到喚醒為止,通常是藉由em <notified/em>或<em>interrupted</em> 來喚醒它。<> (繼承來源 Object) |
| Wait(Int64, Int32) |
讓目前的線程等到喚醒為止,通常是因為 <em>notified</em> 或 <em>interrupted</em>,或直到經過一定數量的實時為止。 (繼承來源 Object) |
| Wait(Int64) |
讓目前的線程等到喚醒為止,通常是因為 <em>notified</em> 或 <em>interrupted</em>,或直到經過一定數量的實時為止。 (繼承來源 Object) |
明確介面實作
| 名稱 | Description |
|---|---|
| IJavaPeerable.Disposed() |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| IJavaPeerable.Finalized() |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
維護全域應用程式狀態的基類。 (繼承來源 JavaObject) |
| IJavaPeerable.UnregisterFromRuntime() |
維護全域應用程式狀態的基類。 |
擴充方法
| 名稱 | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
取得實例 |
| JavaAs<TResult>(IJavaPeerable) |
試著強制 |
| JavaCast<TResult>(IJavaObject) |
執行 Android 執行時間檢查的類型轉換。 |
| JavaCast<TResult>(IJavaObject) |
維護全域應用程式狀態的基類。 |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
試著強制 |