In this example, MyKeyboardView is an instance of a custom implementation of KeyboardView that renders a Keyboard . Candidates view. The candidates view is the ...
Platform
AndroidStudio
GooglePlay
Jetpack
Kotlin
Docs
Games
Language
English
BahasaIndonesia
Español–AméricaLatina
Português–Brasil
中文–简体
日本語
한국어
Signin
Documentation
Overview
Guides
Reference
Samples
Design&Quality
Platform
AndroidStudio
GooglePlay
Jetpack
Kotlin
Docs
Overview
Guides
Reference
Samples
Design&Quality
Games
AppBasics
Introduction
BuildyourfirstappOverviewCreateanAndroidprojectRunyourappBuildasimpleuserinterfaceStartanotheractivity
Appfundamentals
AppresourcesOverviewHandleconfigurationchanges
LocalizationLocalizeyourappTestyourappwithpseudolocalesUnicodeandinternationalizationsupportLanguageandlocaleresolutionComplexXMLresources
ResourcetypesOverviewAnimationColorstatelistDrawableLayoutMenuStringStyleFontMoretypes
AppmanifestfileOverview
Devices
DevicecompatibilityOverviewScreencompatibilityoverviewSupportdifferentpixeldensitiesSupportdisplaycutoutsDeclarerestrictedscreensupport
MultipleAPKsupportOverviewCreatemultipleAPKsfordifferentAPIlevelsCreatemultipleAPKsfordifferentscreensizesCreatemultipleAPKsfordifferentGLtexturesCreatemultipleAPKswithseveraldimensionsSupportdifferentlanguagesandculturesSupportdifferentplatformversionsFiltersonGooglePlay
Tablets,largescreens,andfoldablesGetstartedwithlargescreens
BuildresponsiveUIsSupportdifferentscreensizesNavigationforresponsiveUIsMigrateyourUItoresponsivelayoutsActivityembeddingMulti-windowsupportInputcompatibilityonlargescreens
BuildforfoldablesLearnaboutfoldablesMakeyourappfoldawareTestyourapponfoldables
WearGetstartedPrinciplesofWearOSdevelopmentUpgradetothelatestversionofWearOSWearOSversusmobiledevelopmentSetupJetpackComposeonWearOSUseJetpackComposeonWearOSWearOSdeveloperpathwayOngoingActivitiesWearOSuserinterfaceTilesExposedatatocomplications
GettingstartedCreateandrunawearableappDebugaWearOSappCaptureWearUIscreenshotsAppearinRecentsandAppResume
OverlaysOverviewUsetheWearUIlibraryHandledifferentwatchshapesScreenoptionsCreatelistsNavigationExitfullscreenactivitiesonWearShowconfirmationsPlayingaudioonwearablesWetmodeKeepyourappvisibleonWearAuthenticationStandaloneapp
NotificationsNotificationsonWearOSBridgingoptionsfornotifications
HandlingdataSendandsyncdataonWearOSNetworkaccessandsynconWearOSAccesstheWearableDataLayerTransferassetsSendandreceivemessagesHandledatalayereventsSyncdataitemswiththeDataLayerAPIRequestpermissionsDetectlocation
UserinputPhysicalbuttonsRotaryinputCreateinputmethodeditorsinWearVoice
WatchFaceStudioWatchFaceStudioKeyboardshortcutsManageaWatchFaceStudioprojectCreateawatchfacewithWatchFaceStudioBuildcomplicationsinWatchFaceStudioTagexpressionsLanguagesettingsAlways-oninWatchFaceStudioGyroeffectsBuildanduploadfromWatchFaceStudioTestyourwatchfaceFAQ
HealthservicesOverviewActivedataandexercisePassivedataupdatesUsesyntheticdataprovidersHealthPlatformAPI
DesignIntroductionDesignprinciplesGettingstartedInteractiontypesNotificationsComplicationsTilesOverlaysOngoingactivitiesConfirmationoverlayDisconnectionindicatorsPermissionmessagesSelectioncontrolsLaunchandlatencyNavigationPermissionsSigninHardwarebuttonsColorTypographyIconsDownloads
ComponentsWearMaterialThemingButtonsChipsTogglechipsCardsListsCurvedtextsSwipetodismissScrollindicatorsPickersPageviewersSlidersProgressindicator
CreatingwatchfacesOverviewDesignwatchfacesBuildawatchfaceserviceDrawwatchfacesWatchfacecomplicationsAddingcomplicationstoawatchfaceCreatinginteractivewatchfacesProvideconfigurationactivitiesAddresscommonissuesImproveperformacewithhardwareaccelerationOptimizeperformanceandbatterylifeWearappqualityPackageWearOSappsDistributetoWearOSCreateWearOSappsforChinaWearOSreleasenotes
AndroidTVOverview
BuildTVAppsOverviewGetstartedwithTVappsAndroidXTVlibrariesHandleTVhardwareManageTVcontrollersBuildTVlayoutsOn-screenkeyboardCreateTVnavigationBestpracticesfordrivingengagementonGoogleTV
BuildTVplaybackappsOverviewCreateacatalogbrowserProvideacardviewBuildadetailsviewUseLeanbacktransportcontrolsPlaybackcontrolsonTVDisplayaNowPlayingcardAddaguidedstepIntroducefirst-timeuserstoyourappEnablebackgroundplaybackAudiocapabilitiesManageframerates
HelpusersfindcontentonTVOverview
RecommendTVcontentOverviewChannelsonthehomescreenVideoprogramattributesAudioprogramattributesGameprogramattributes
WatchNextAddprogramsAttributesGuidelinesforappdevelopersGuidelinesforTVprovidersPreviewvideosRecommendationsinAndroidNandearlierMakeTVappssearchableSearchwithinTVApps
BuildTVgamesOverviewUseStreamProtectforlatency-sensitivestreamingapps
BuildTVinputservicesOverviewDevelopaTVinputserviceWorkwithchanneldataManageTVuserinteractionSupporttime-shiftingSupportcontentrecordingTVAppschecklist
TVAccessibilityAccessibilitybestpracticesTalkBackevaluationexamplesAdoptsystemcaptionsettingsCustomviewaccessibilitysupportCustomviewaccessibilitysampleAndroid12DeveloperPreviewforTV
AndroidforCarsOverview
BuildmediaappsforcarsBuildmediaappsforcarsAddsupportforAndroidAutoAddsupportforAndroidAutomotiveOSBuildmessagingappsforAndroidAuto
Buildnavigation,parking,andchargingappsforcarsUsingtheAndroidforCarsAppLibraryBuildparkingandchargingappsforcarsBuildnavigationappsforcarsAddsupportforAndroidAutoTestAndroidappsforcarsGooglePlayservicesNotificationsonAndroidAutomotiveOS
AndroidThingsOverviewPlatformdifferencesGoogleservices
SupportedhardwareOverviewNXPi.MX7DRaspberryPi3
AdvancedsetupOverviewManuallyflashanimageRecoveradeviceConnectingtoWi-Fiwithadb
Buildapps
CreateaThingsappOverviewCreateaprojectConnectthehardwareInteractwithperipheralsIntegrateperipheraldrivers
CommunicatewithwirelessdevicesBluetoothLoWPAN
ConfiguredevicesSettingsUpdates
InteractwithperipheralsOverviewGPIOPWMI2CSPIUARTNativePIOCLItoolIntegratenativecode
Builduser-spacedriversOverviewLocationInputSensorsLoWPANSamples
ManagedevicesOverviewCreateaproductConfigureaproduct
CreateabuildOverviewManageapps
PushanupdateOverviewAutomaticupdatesMonitoranalytics
TermsConsoleTermsofServiceSDKLicenseAgreementAndroidThingsConsole
ChromeOSdevicesOverviewBuildingappsforChromeOSOptimizingAppsforChromeOSPreparingyourdevelopmentenvironmentAppManifestCompatibilityforChromebooksChromeOSDeviceSupportforAppsAppRenderingDifferencesonChromebooksWindowmanagementAdaptingGamesonChromeOSSmoothanimationonChromeOSTestCasesforAndroidAppsonChromeOS
Apparchitecture
Introduction
Guidetoapparchitecture
ArchitectureComponents
UIlayerlibraries
ViewbindingOverviewMigratefromKotlinsyntheticstoviewbinding
DatabindinglibraryOverviewGetstartedLayoutsandbindingexpressionsWorkwithobservabledataobjectsGeneratedbindingclassesBindingadaptersBindlayoutviewstoArchitectureComponentsTwo-waydatabinding
Lifecycle-awarecomponentsHandlelifecyclesViewModelLiveDataSaveUIstatesSavedStatemoduleforViewModelUseKotlincoroutineswithlifecycle-awarecomponents
PagingLibraryOverviewLoadanddisplaypageddataPagefromnetworkanddatabaseTransformdatastreamsManageandpresentloadingstatesTestyourPagingimplementationMigratetoPaging3
Paging2OverviewDisplaypagedlistsLoadpageddata
DatalayerlibrariesDataStore
WorkManagerOverviewGettingStarted
How-ToGuidesDefiningyourWorkRequestsWorkstatesManagingworkObservingintermediateWorkerprogressChainingworktogetherTestingWorkerimplementationIntegrationtestswithWorkManagerDebuggingWorkManager
AdvancedConceptsConfigurationandInitialization
ThreadinginWorkManagerOverviewThreadinginWorkerThreadinginCoroutineWorkerThreadinginRxWorkerThreadinginListenableWorkerSupportforlong-runningworkersMigratingfromFirebaseJobDispatcherMigratingfromGCMNetworkManager
Appentrypoints
ActivitiesIntroductiontoactivitiesTheactivitylifecycleActivitystatechangesTestyouractivitiesTasksandbackstackProcessesandapplifecycleParcelablesandbundlesLoadersRecentsscreenRestrictionsonstartingactivitiesfromthebackground
AppshortcutsOverviewCreateshortcutsAddcapabilitiesManageshortcutsBestpracticesforshortcuts
AppnavigationPrinciplesofnavigationDesignfordifferentformfactorsHandleconfigurationchanges
NavigationcomponentOverviewGettingstartedCreatedestinationsDesignnavigationgraphsNestedgraphsGlobalactionsNavigatetoadestinationConditionalnavigationPassdatabetweendestinationsCreateadeeplinkforadestinationAnimatetransitionsbetweendestinationsUpdateUIcomponentswithNavigationUIKotlinDSLInteractprogrammaticallyNavigatewithfeaturemodulesBestpracticesformulti-moduleprojectsTestnavigationAddnewdestinationtypesMigratetotheNavigationcomponent
FragmentsOverviewCreateafragmentFragmentmanagerFragmenttransactionsAnimatetransitionsbetweenfragmentsFragmentlifecycleSavingstatewithfragmentsCommunicatewithfragmentsWorkingwiththeappbarDisplayingdialogswithDialogFragmentDebugyourfragmentsTestyourfragments
ApplinksOverviewEnablinglinkstoappcontentVerifyapplinksCreateapplinksforinstantappsCreateswipeviewswithtabsusingViewPagerCreateswipeviewswithtabsusingViewPager2Providecustombacknavigation
DependencyinjectionOverviewManualdependencyinjectionDependencyinjectionwithHiltHiltinmulti-moduleappsHiltandJetpackintegrationsHilttestingguideHiltandDaggerannotationscheatsheet
DaggerDaggerbasicsUsingDaggerinAndroidappsUsingDaggerinmulti-moduleapps
AppStartup
Coretopics
AppcompatibilityOverviewCompatibilityframeworktoolsRestrictionsonnon-SDKinterfaces
InteractwithotherappsOverviewSendingtheusertoanotherappGettingaresultfromanactivityAllowingotherappstostartyouractivity
PackagevisibilityOverviewKnowwhichpackagesarevisibleautomaticallyDeclarepackagevisibilityneedsFulfillcommonusecasesTestpackagevisibility
IntentsandintentfiltersOverviewCommonintents
UserinterfaceOverview
LayoutsOverviewBuildaresponsiveUIwithConstraintLayout
AddmotiontoyourlayoutwithMotionLayoutOverviewCarouselwithMotionLayoutMotionLayoutexamples
MotionLayoutXMLreferenceOverviewCreatealistwithRecyclerViewAdvancedRecyclerViewcustomizationCreateacard-basedlayoutCreateatwopanelayout
ImprovinglayoutperformanceOverviewOptimizinglayouthierarchiesRe-usinglayoutswithDelayedloadingofviewsLinearlayoutAdapterviewRelativelayout
CustomviewcomponentsOverviewCreatingacustomviewclassImplementingcustomdrawingMakingtheviewinteractiveOptimizingtheviewDesigningforfoldables
LookandfeelMaterialdesignStylesandthemesDarkthemeRoundedcornersAdaptiveiconsAddafloatingactionbuttonCreateshadowsandclipviews
TextAutosizingTextViewsDownloadablefontsFontsinXML
EmojiSupportmodernemojiEmojicompatibilityMagnifierwidgetSpansButtonsCheckboxesRadiobuttonsTogglebuttonsSpinnersPickersTooltips
NotificationsOverviewCreateanotificationCreateanexpandablenotificationDisplaytime-sensitivenotificationsStartanactivityfromanotificationCreateagroupofnotificationsCreateandmanagenotificationchannelsModifyanotificationBadgeCreateacustomnotification
SplashscreensOverviewMigrateyourexistingsplashscreenConversationsBubbles
AddtheappbarOverviewSetuptheappbarAddandhandleactionsAddanupactionUseactionviewsandactionproviders
ControlthesystemUIvisibilityOverviewDimthesystembarsHidethestatusbarHidethenavigationbarEnablefullscreenmodeRespondtoUIvisibilitychanges
Supportingswipe-to-refreshOverviewAddingswipe-to-refreshtoyourappRespondingtoarefreshgestureToastsoverview
Pop-upmessagesoverviewOverviewBuildanddisplayapop-upmessageAddanactiontoamessageDialogsMenus
SettingsOverviewOrganizeyoursettingsCustomizeyoursettingsUsesavedvaluesBuildahierarchyincodeHandleotherformfactorsPreferencecomponentsandattributes
SearchOverviewCreatingasearchinterfaceAddingrecentquerysuggestionsAddingcustomsuggestionsSearchableconfiguration
AddingsearchfunctionalityOverviewSettingupthesearchinterfaceStoringandsearchingfordataRemainingbackwardcompatibleCopyandpasteDraganddropPicture-in-picturesupport
Creatingbackward-compatibleUIsOverviewAbstractingthenewAPIsProxyingtothenewAPIsCreatinganimplementationwitholderAPIsUsingtheversion-awarecomponentDevicecontrol
HomechannelsformobileappsOverviewMediaHomeBooksMediaHomeVideo
AppwidgetsOverviewCreateasimplewidgetEnhanceyourwidgetCreateanadvancedwidgetUsewidgetcollectionsProvideflexiblewidgetlayoutsEnablewidgetconfigurationBuildanappwidgethost
Animations&transitionsOverviewIntroductiontoanimationsPropertyanimationoverviewAnimatedrawablegraphicsRevealorhideaviewusinganimationMoveaviewusinganimationMoveaviewusingaflinganimationEnlargeaviewusingazoomanimationAnimatemovementusingspringphysicsAutoanimatelayoutupdatesAnimatelayoutchangesusingatransitionCreateacustomtransitionanimationStartanactivityusingananimationSlidebetweenfragmentsusingViewPagerSlidebetweenfragmentsusingViewPager2MigratefromViewPagertoViewPager2Additionalresources
Images&graphicsOverviewDrawablesoverviewVectordrawablesoverviewHandlingbitmapsSelectingcolorswiththepaletteAPIReducingimagedownloadsizesHardwareaccelerationOpenGLES
DisplayinggraphicswithOpenGLESOverviewBuildinganOpenGLESenvironmentDefiningshapesDrawingshapesApplyingprojectionandcameraviewsAddingmotionRespondingtotouchevents
RenderingOverviewReducingoverdrawPerformanceandviewhierarchiesAnalyzingwithprofileGPUrenderingEnhancinggraphicswithwidecolorcontent
Audio&videoAudio&videooverviewMediacontrolsSupportedmediaformatsMediacodecs
MediaapparchitectureMediaapparchitectureoverviewUsingamediasession
BuildinganaudioappAudioappoverviewBuildingamediabrowserserviceBuildingamediabrowserclientMediasessioncallbacksUsingthemediacontrollertestapp
BuildingavideoappVideoappoverviewBuildingavideoplayeractivityMediasessioncallbacksCompatiblemediatranscodingRespondingtomediabuttonsHandlingchangesinaudiooutputManageaudiofocus
TheGoogleAssistantTheGoogleAssistantandmediaappsMediaappsonGoogleAssistantdrivingmode
RoutingbetweendevicesRoutingoverviewMediaRouteroverviewMediaRouteProvideroverviewControlamplitudewithVolumeShaperMediaPlayeroverviewMediaRecorderoverviewExoPlayerSharingaudioinputCapturevideoandaudioplaybackFramerateBestpracticesforsharingvideoAdditionalResourcesforMedia
ServicesOverviewForegroundservicesBoundservicesAIDLoverview
BackgroundtasksOverviewBackgroundthreadsBackgroundoptimizations
BroadcastsOverviewImplicitBroadcastExceptions
ManagedeviceawakestateOverviewKeepthedeviceawakeSchedulealarms
PermissionsOverviewEvaluatewhetheryourappneedspermissionsDeclareapppermissionsRequestapppermissionsExplainaccesstomoresensitiveinformationApppermissionsbestpracticesPermissionsusedonlyindefaulthandlersRestrictinteractionswithotherappsDefinecustompermissions
Appdata&filesOverviewStorageoverviewSavetoapp-specificstorage
SavetosharedstorageOverviewMediaDocumentsandotherfilesDatasetsManageallfilesonastoragedeviceSavekey-valuedata
SavedatainalocaldatabaseOverviewDefinedatausingentitiesAccessdatausingDAOsDefinerelationshipsbetweenobjectsWriteasynchronousDAOqueriesCreateviewsintoadatabasePrepopulateyourdatabaseMigrateyourdatabaseTestanddebugyourdatabaseReferencecomplexdataMigratefromSQLitetoRoomSavedatausingSQLiteStorageusecasesandbestpractices
SharingsimpledataOverviewSendingsimpledatatootherappsReceivingsimpledatafromotherapps
SharingfilesOverviewSettingupfilesharingSharingafileRequestingasharedfileRetrievingfileinformation
SharingfileswithNFCOverviewSendingfilestoanotherdeviceReceivingfilesfromanotherdevice
PrintingfilesOverviewPrintingphotosPrintingHTMLdocumentsPrintingcustomdocuments
ContentprovidersOverviewContentproviderbasicsCreatingacontentproviderOpenfilesusingstorageaccessframeworkCreateacustomdocumentproviderAppinstalllocation
Userdata&identityOverviewAddsign-inworkflowShowabiometricauthenticationdialog
AutofillframeworkOverviewOptimizeyourappforautofillBuildautofillservicesIntegrateautofillwithkeyboardsIdentifydeveloper-ownedappsReviewhowyourappcollectsandsharesuserdataAuditdataaccessGetauser-resettableadvertisingIDCalendarprovideroverview
ContactsproviderOverviewRetrievingalistofcontactsRetrievingdetailsforacontactModifyingcontactsusingintentsDisplayingthequickcontactbadgeAccounttransfer
DatabackupOverviewBackupuserdataBackupkey-valuepairsTestbackupandrestoreBestpracticesforuniqueidentifiers
RememberandauthenticateusersOverviewRememberyouruserAuthenticatetoOAuth2servicesCreateacustomaccounttype
UserlocationOverviewRequestlocationpermissionsGetthelastknownlocationChangelocationsettingsRequestlocationupdatesAccesslocationinthebackgroundCreateandmonitorgeofencesDetectwhenusersstartanactivityOptimizelocationforbatteryTestlocationworkflowsMigratetolocationandcontextAPIsAddmaps
Touch&inputOverviewInputevents
UsingtouchgesturesOverviewDetectcommongesturesTracktouchandpointermovementsAnimateascrollgestureSupportnavigationgesturesImplementedge-to-edgeHandlemulti-touchgesturesDragandscaleManagetoucheventsinaViewGroup
HandlingkeyboardinputOverviewSpecifyingtheinputmethodtypeHandlinginputmethodvisibilitySupportingkeyboardnavigationHandlingkeyboardactions
SupportinggamecontrollersOverviewHandlingcontrolleractionsSupportingcontrollersacrossAndroidversionsSupportingmultiplegamecontrollers
InputmethodeditorsCreatinganinputmethodImagekeyboardReceiverichcontentSpellingchecker
CameraXOverviewCameraXarchitectureConfigurationPreviewImageanalysisImagecaptureVideocaptureExtensionsAPITransformoutputUsecaserotationsCameraXdevices
Camera2OverviewCameracapturesessionsandrequestsCameraenumerationUsemultiplecamerastreamssimultaneouslyCamerapreviewonlargescreensMulti-CameraAPIExtensionsAPI
CameraOverviewTakingphotosRecordingvideosControllingthecameraCameraAPI
SensorsOverviewSensorsoverviewMotionsensorsPositionsensorsEnvironmentsensorsRawGNSSmeasurements
ConnectivityOverview
PerformingnetworkoperationsOverviewConnecttothenetworkManagenetworkusageReadingnetworkstateOptimizenetworkdatausageParseXMLdata
TransmitnetworkdatausingVolleyOverviewSendasimplerequestSetupRequestQueueMakeastandardrequestImplementacustomrequest
PerformnetworkoperationsusingCronetOverviewSendasimplerequestCronetrequestlifecycle
Reference
org.chromium.netOverviewCallbackException
CronetEngineOverview
CronetEngine.BuilderOverviewLibraryLoaderCronetExceptionInlineExecutionProhibitedExceptionNetworkExceptionQuicExceptionUploadDataProviderUploadDataProvidersUploadDataSink
UrlRequestOverviewBuilderCallbackStatusStatusListener
UrlResponseInfoOverviewHeaderBlockEnhanceyourappswith5GBuildclient-serverapplicationswithgRPC
TransferringdatawithoutdrainingthebatteryOverviewOptimizedownloadsforefficientnetworkaccessMinimizetheeffectofregularupdatesAvoidredundantdownloadsModifypatternsbasedontheconnectivitytype
ReducenetworkbatterydrainOverviewCollectingnetworktrafficdataAnalyzingdatatrafficOptimizeuser-initiatednetworkuseOptimizeapp-initiatednetworkuseOptimizeserver-initiatednetworkuseOptimizinggeneralnetworkuse
TransferdatausingSyncAdaptersOverviewCreateaStubAuthenticatorCreateaStubContentProviderCreateaSyncAdapterRunaSyncAdapter
BluetoothOverviewSetupBluetoothFindBluetoothdevicesConnectBluetoothdevicesTransferBluetoothdataBluetoothpermissionsBluetoothprofilesCompaniondevicepairing
BluetoothLowEnergyOverviewFindBLEdevicesConnecttoaGATTserverTransferBLEdata
NFCOverviewNFCbasicsAdvancedNFCHost-basedcardemulationoverview
TelecomOverviewBuildacallingappPreventcallerIDspoofingTelephonyIDs
Wi-FiWi-FiscanningoverviewWi-Fipeer-to-peerWi-FiAwareoverviewWi-FilocationwithRTTLocalOnlyHotspot
Wi-FiinfrastructureWi-FiinfrastructureoverviewWi-FisuggestionAPIforinternetconnectivityWi-FiNetworkRequestAPIforpeer-to-peerconnectivityPasspointSavenetworksandPasspointconfigurations
USBOverviewAccessoryoverviewHostoverviewVPNSessioninitiationprotocoloverview
DiscoverandconnectOverviewUsenetworkservicediscoveryCreateP2PconnectionswithWi-FiUseWi-FiP2PforservicediscoveryWi-FiEasyConnectOpenMobileAPIreadersupport
RenderscriptOverviewAdvancedRenderScriptMigratefromRenderScript
RuntimeAPIreferenceOverviewNumericaltypesObjecttypesConversionfunctionsMathematicalconstantsandfunctionsVectormathfunctionsMatrixfunctionsQuaternionfunctionsAtomicupdatefunctionsTimefunctionsandtypesAllocationdataaccessfunctionsObjectcharacteristicsfunctionsKernelinvocationfunctionsandtypesInput/outputfunctionsDebuggingfunctionsGraphicsfunctionsandtypesIndex
Web-basedcontentOverviewBuildingwebappsinWebViewManagingWebViewobjectsLoadlocalcontentDarkenwebcontentUserprivacyinWebViewcrashreportingMigratingtoWebViewinAndroid4.4SupportingdifferentscreensinwebappsDebuggingwebappsBestpracticesforwebapps
AndroidAppBundlesOverviewConfigurethebasemoduleBuildandtestyourappbundleAddcodetransparencyTheappbundleformatFrequentlyaskedquestions
GooglePlayGooglePlayBillingPlayCoreLibrary
PlayAssetDeliveryOverviewIntegrateassetdelivery(Kotlin&Java)Integrateassetdelivery(native)Integrateassetdelivery(Unity)TargettexturecompressionformatsTestassetdelivery
PlayFeatureDeliveryOverviewConfigureinstall-timedeliveryConfigureconditionaldeliveryConfigureon-demanddeliveryOn-demanddeliverybestpracticesConfigureinstantdeliveryAdditionalresources
In-appreviewsOverviewIntegrateusingKotlinorJavaIntegrateusingnativecodeIntegrateusingUnityTestin-appreviews
In-appupdatesOverviewSupportin-appupdates(KotlinorJava)Supportin-appupdates(Native)Supportin-appupdates(Unity)Testin-appupdates
GooglePlayInstantOverviewofGooglePlayInstant
GetstartedwithinstantappsCreateaninstant-enabledappbundleUXbestpracticesforapps
GetstartedwithinstantgamesOverviewUnitypluginUXbestpracticesforgamesMigratetoAndroidAppBundlesImplementclouddeliveryofassetsSupportGooglePlayGamesServicesInstantPlaygamesInstantPlaygameschecklistReducethesizeofyourinstantapporgameAddadstoyourinstantapporgameProvidemultipleentrypoints
IntegratewithFirebaseAddGoogleAnalyticsforFirebasetoyourinstantappUseFirebaseDynamicLinkswithinstantappsTechnicalrequirementschecklistGooglePlayInstantpolicy
ResourcesReferenceCodesamplesSDKreleasenotesInstantAppIntents
SupportKnownissuesStackOverflowPlayDeveloperAPI
PlayInstallReferrerOverview
PlayInstallReferrerLibraryOverviewReferenceReleasenotesPlayInstallReferrerAPIPlayIntegrityAPI
ApplicationLicensingOverviewLicensingOverviewSettingUpforLicensingAddingServer-SideVerificationAddingClient-SideVerificationLicensingReferenceAPKExpansionFiles
AppActions
SlicesOverviewGettingStartedSlicetemplates
On-devicesearch
Games
ToolsAndroidStudio
AndroidGameDevelopmentExtensionforVisualStudioOverviewQuickstartConfigureaprojectDebuggerMeasureappperformanceSamplesReleasenotesAndroidNDK
AndroidGPUInspectorOverviewQuickstart
SystemprofilingOverviewViewasystemprofile
AnalyzeasystemprofileFrameprocessingtimesMemoryefficiencyTexturememorybandwidthusageVertexmemorybandwidthusageThreadscheduling
GPUperformancecountersArmMaliQualcommAdrenoImaginationPowerVR
FrameprofilingOverview
AnalyzeaframeprofileMostexpensiverenderpassesVertexformatsShaderperformance
FrameProfilerUIPerformancepaneCommandspaneFramebufferpaneGeometrypaneReportpaneShaderpaneMemorypaneStatepaneTexturespaneTexturepanePipelineviewpaneSupportedVulkanextensionsTroubleshoot
CustomizeorportgameenginesOverview
GettingstartedIntegrateGameActivityConfiguregraphicsUnderstandAndroidgameloops
ProcessinputeventsAddtouchsupportSupporttextinput
SupportgamecontrollersOverviewUsethegamecontrollerlibraryUsecustomcontrollerdevicemappingsAddmousesupportSupportsensorinput
AchieveproperframepacingOverview
FramepacinginOpenGLESIntegrateUpdateyourbuildsettingsAddframepacingfunctionsVerifyframepacingimprovement
FramepacinginVulkanIntegrateUpdateyourbuildsettingsAddframepacingfunctionsVerifyframepacingimprovementReference
IntegrateAndroidPerformanceTunerOverviewRunthedemoappEnabletheAPIUpdateyourbuildsettingsDefineannotations,fidelityparameters,andsettingsAddframetimingfunctionsAddloadingtimerecordingfunctionsValidate,package,andpublishtheAPKTroubleshootcommonerrorsAdvancedusageReference
OutputaudioOverviewUpdatebuildsettingsUseOboeCodesamplesFullOboeguide
ManagememoryOverviewDebugnativememoryuseDeliverassetsDetectanddiagnosecrashes
UseprebuiltorturnkeygameenginesOverview
DevelopwithDefoldInstallandconfigureprojectsforAndroidSupportmultipleformfactorsandscreensizesExporttoAndroid
DevelopwithGodotInstallandconfigureprojectsforAndroidGodotrendereroptionsSupportmultipleformfactorsandscreensizesExporttoAndroid
DevelopwithUnityOverviewCreateanAndroidAppBundlewithUnityIntegratePlayAssetDeliveryUnityLightinginMobileGames
UseAndroidPerformanceTunerOverviewEnabletheAPIIntegratethepluginInitializethelibraryandverifyoperationDefineannotations,fidelityparameters,andqualitylevelsAddloadingtimerecordingfunctionsRunthemonitorappReviewandpublishTroubleshootcommonerrorsReferenceDevelopwithUnrealRequestinguserpermissionsSecureyourgame
Gamebestpractices
MaximizedeviceavailabilitySupport64-bitarchitecturesDevelopgamesforallscreensSign-in,savegames,andmorewithPlayGamesServices
ArtassetsGeometrybestpractices
OpenGLandVulkanDeviceorientationefficientlyinVulkanVertexdatamanagement
GameModeOverviewOptimizewithGameModeAPIGameModeinterventions
OptimizeCPU,memory,andgraphicstoolsAndroidPerformanceTuner
GuidesImprovegameperformanceReducegamesize
DistributeOverviewReleasewithGooglePlayInstantPlayasyoudownload
Bestpractices
TestingOverviewFundamentalsoftestingSetupproject
BuildingeffectiveunittestsOverviewBuildinglocalunittestsBuildinginstrumentedunittests
AutomatingUItestsOverviewTestingUIforasingleappTestingUIformultipleapps
TestingappcomponentintegrationsOverviewTestingyourserviceTestingyourcontentproviderTestingUIperformance
EspressoOverviewSetupinstructionsBasicsRecipesMultiprocessAccessibilitycheckingListsIntentsWebIdlingresourceCheatsheetAdditionalresourcesUIAutomatorAppCrawlerJUnit4RulesAndroidJUnitRunnerReleasenotesAdditionalresources
PerformanceOverviewPerformanceclass
AndroidVitalsOverviewStuckPartialWakeLocksExcessiveWakeupsExcessiveBackgroundWi-FiScansExcessiveBackgroundNetworkUsageANRsCrashesSlowRenderingFrozenFramesPermissionDenialsAppStartupTimeAppStandbyBucketsAppHibernationProcessesandThreadsOverviewBetterPerformancethroughThreading
OptimizingforBatteryLifeOverviewOptimizeforDozeandAppStandbyMonitorthebatterylevelandchargingstateMonitorconnectivitystatusandconnectionmeteringDetermineandmonitorthedockingstateandtypePowermanagementrestrictionsProfilebatteryusagewithBatterystatsandBatteryHistorianAnalyzepowerusewithBatteryHistorianTestingpower-relatedissuesReduceyourappsize
ManagememoryOverviewofMemoryManagemementMemoryAllocationamongProcessesManageYourApp'sMemory
SystemtracingOverviewCaptureatracefromthecommandlineCaptureatraceonadeviceNavigateareportDefinecustomeventsCustomtraceeventsinnativecodeInspectGPUrenderingDesigningforSeamlessnessKeepingYourAppResponsivePerformanceTipsSMPPrimerforAndroidVerifyingAppBehaviorontheAndroidRuntime(ART)
AccessibilityOverview
BuildandtestappsforaccessibilityMakeappsmoreaccessiblePrinciplesforimprovingappaccessibilityTestyourapp'saccessibility
AdvancedtopicsMakecustomviewsmoreaccessibleCreateyourownaccessibilityserviceAdditionalresources
PrivacyPrivacybestpractices
SecurityAppsecuritybestpracticesSecuritytipsSecuritywithdataSecuritywithdataacrossadditionalAndroidversionsSecuritywithHTTPSandSSLNetworksecurityconfigurationUpdatingyoursecurityprovidertoprotectagainstSSLexploits
ProtectingagainstsecuritythreatswithSafetyNetOverviewSafetyNetAttestationAPISafetyNetSafeBrowsingAPISafetyNetreCAPTCHAAPISafetyNetVerifyAppsAPICryptographyAndroidKeystoreSystemVerifyinghardware-backedkeypairswithkeyattestationAndroidProtectedConfirmationSupportingDirectBootRunningembeddedDEXcodeAppsecurityimprovementprogram
BuildforBillionsOverviewConnectivityDevicecapabilityDatacostBatteryconsumptionUIandcontent
BuildforEnterpriseOverviewDeveloperguideWorkprofilesSetupmanagedconfigurations
AppfeedbackSendappfeedbacktoEMMsTestappfeedbackWorkcontactsDevicemanagementpolicies
DevicemanagementOverviewBuildadevicepolicycontroller
DedicateddevicesOverviewLocktaskmodeMultipleusersCookbookDevicecontrolNetworkingandtelephonySecuritySystemupdatesNetworkactivitylogging
AndroidversionsOverviewAndroid12Android11Android10Android9Android8.0Android7.0Deviceadministration
AndroidDevelopers
Docs
Guides
Createaninputmethod
Aninputmethodeditor(IME)isausercontrolthatenablesuserstoentertext.Android
providesanextensibleinput-methodframeworkthatallowsapplicationstoprovideusers
alternativeinputmethods,suchason-screenkeyboardsorevenspeechinput.Afterinstalling
thedesiredIMEs,ausercanselectwhichonetousefromthesystemsettings,anduseit
acrosstheentiresystem;onlyoneIMEmaybeenabledatatime.
ToaddanIMEtotheAndroidsystem,youcreateanAndroidapplication
containingaclassthatextendsInputMethodService.In
addition,youusuallycreatea"settings"activitythatpassesoptionstotheIMEservice.You
canalsodefineasettingsUIthat'sdisplayedaspartofthesystemsettings.
Thisguidecoversthefollowing:
TheIMElifecycle
DeclaringIMEcomponentsintheapplicationmanifest
TheIMEAPI
DesigninganIMEUI
SendingtextfromanIMEtoanapplication
WorkingwithIMEsubtypes
Ifyouhaven'tworkedwithIMEsbefore,youshouldreadtheintroductoryarticle
OnscreenInputMethodsfirst.
Note:BeginningwithAndroid 11,the
platformallowsIMEstodisplayautofillsuggestionsinline,insteadof
usingapulldownmenu.Formoreinformationonhowautofillservicescansupport
thisfunctionality,seeIntegratingautofillwith
keyboards.
TheIMElifecycle
ThefollowingdiagramdescribesthelifecycleofanIME:
Figure1.ThelifecycleofanIME.
ThefollowingsectionsdescribehowtoimplementtheUIandcodeassociatedwithanIMEthat
followsthislifecycle.
DeclareIMEcomponentsinthemanifest
IntheAndroidsystem,anIMEisanAndroidapplicationthatcontainsaspecialIMEservice.
Theapplication'smanifestfilemustdeclaretheservice,requestthenecessarypermissions,
provideanintentfilterthatmatchestheactionaction.view.InputMethod,and
providemetadatathatdefinescharacteristicsoftheIME.Inaddition,toprovideasettings
interfacethatallowstheusertomodifythebehavioroftheIME,youcandefinea"settings"
activitythatcanbelaunchedfromSystemSettings.
ThefollowingsnippetdeclaresanIMEservice.Itrequeststhepermission
BIND_INPUT_METHODtoallowtheservicetoconnecttheIME
tothesystem,setsupanintentfilterthatmatchestheaction
android.view.InputMethod,anddefinesmetadatafortheIME:
ThisnextsnippetdeclaresthesettingsactivityfortheIME.Ithasanintentfilterfor
ACTION_MAINthatindicatesthisactivityisthemainentrypoint
fortheIMEapplication:
YoucanalsoprovideaccesstotheIME'ssettingsdirectlyfromitsUI.
TheinputmethodAPI
ClassesspecifictoIMEsarefoundintheandroid.inputmethodserviceand
android.view.inputmethodpackages.TheKeyEventclassis
importantforhandlingkeyboardcharacters.
ThecentralpartofanIMEisaservicecomponent,aclassthatextends
InputMethodService.Inadditiontoimplementingthe
normalservicelifecycle,thisclasshascallbacksforprovidingyourIME'sUI,handlinguser
input,anddeliveringtexttothefieldthatcurrentlyhasfocus.Bydefault,the
InputMethodServiceclassprovidesmostoftheimplementation
formanagingthestateandvisibilityoftheIMEandcommunicatingwiththecurrentinput
field.
Thefollowingclassesarealsoimportant:
BaseInputConnection
DefinesthecommunicationchannelfromanInputMethod
backtotheapplicationthatisreceivingitsinput.Youuseittoreadtextaroundthe
cursor,committexttothetextbox,andsendrawkeyeventstotheapplication.
Applicationsshouldextendthisclassratherthanimplementingthebaseinterface
InputConnection.
KeyboardView
AnextensionofViewthatrendersakeyboardandrespondstouser
inputevents.Thekeyboardlayoutisspecifiedbyaninstanceof
Keyboard,whichyoucandefineinanXMLfile.
DesigntheinputmethodUI
TherearetwomainvisualelementsforanIME:theinputviewandthe
candidatesview.Youonlyhavetoimplementtheelementsthatarerelevantto
theinputmethodyou'redesigning.
Inputview
TheinputviewistheUIwheretheuserinputstextintheformofkeyclicks,handwritingor
gestures.WhentheIMEisdisplayedforthefirsttime,thesystemcallsthe
onCreateInputView()callback.Inyour
implementationofthismethod,youcreatethelayoutyouwanttodisplayintheIME
windowandreturnthelayouttothesystem.Thissnippetisanexampleofimplementingthe
onCreateInputView()method:
Kotlin
overridefunonCreateInputView():View{
returnlayoutInflater.inflate(R.layout.input,null).apply{
if(thisisMyKeyboardView){
setOnKeyboardActionListener(this@MyInputMethod)
keyboard=latinKeyboard
}
}
}
Java
@Override
publicViewonCreateInputView(){
MyKeyboardViewinputView=
(MyKeyboardView)getLayoutInflater().inflate(R.layout.input,null);
inputView.setOnKeyboardActionListener(this);
inputView.setKeyboard(latinKeyboard);
returninputView;
}
Inthisexample,MyKeyboardViewisaninstanceofacustom
implementationof
KeyboardViewthatrendersa
Keyboard.
Candidatesview
ThecandidatesviewistheUIwheretheIMEdisplayspotentialwordcorrectionsor
suggestionsfortheusertoselect.IntheIMElifecycle,thesystemcalls
onCreateCandidatesView()whenit'sready
todisplaythecandidatesview.Inyourimplementationofthismethod,returnalayoutthat
showswordsuggestions,orreturnnullifyoudon’twanttoshowanything.Anullresponseis
thedefaultbehavior,soyoudon’thavetoimplementthisifyoudon’tprovidesuggestions.
UIdesignconsiderations
ThissectiondescribessomespecificUIdesignconsiderationsforIMEs.
Handlemultiplescreensizes
TheUIforyourIMEmustbeabletoscalefordifferentscreensizes,anditalso
musthandlebothlandscapeandportraitorientations.Innon-fullscreenIMEmode,leave
sufficientspacefortheapplicationtoshowthetextfieldandanyassociatedcontext,sothat
nomorethanhalfthescreenisoccupiedbytheIME.InfullscreenIMEmodethisisnotan
issue.
Handledifferentinputtypes
Androidtextfieldsallowyoutosetaspecificinputtype,suchasfree-formtext,numbers,
URLs,emailaddresses,andsearchstrings.WhenyouimplementanewIME,youneedtodetect
theinputtypeofeachfieldandprovidetheappropriateinterfaceforit.However,you
don'thavetosetupyourIMEtocheckthattheuserenteredvalidtextfortheinputtype;
that'stheresponsibilityoftheapplicationthatownsthetextfield.
Forexample,herearescreenshotsoftheinterfacesthattheLatinIMEprovidedwiththe
Androidplatformprovidesfortextandphonenumberinputs:
Figure2.LatinIMEinputtypes.
WhenaninputfieldreceivesfocusandyourIMEstarts,thesystemcalls
onStartInputView(),
passinginanEditorInfoobjectthatcontainsdetailsabout
theinputtypeandotherattributesofthetextfield.Inthisobject,the
inputTypefieldcontainsthetextfield'sinput
type.
TheinputTypefieldisanint
thatcontainsbitpatternsforvariousinputtypesettings.Totestitforthetextfield's
inputtype,maskitwiththeconstantTYPE_MASK_CLASS,like
this:
Kotlin
inputTypeandInputType.TYPE_MASK_CLASS
Java
inputType&InputType.TYPE_MASK_CLASS
Theinputtypebitpatterncanhaveoneofseveralvalues,including:
TYPE_CLASS_NUMBER
Atextfieldforenteringnumbers.Asillustratedinthepreviousscreenshot,the
LatinIMEdisplaysanumberpadforfieldsofthistype.
TYPE_CLASS_DATETIME
Atextfieldforenteringadateandtime.
TYPE_CLASS_PHONE
Atextfieldforenteringtelephonenumbers.
TYPE_CLASS_TEXT
Atextfieldforenteringallsupportedcharacters.
Theseconstantsaredescribedinmoredetailinthereferencedocumentationfor
InputType.
TheinputTypefieldcancontainotherbitsthat
indicateavariantofthetextfieldtype,suchas:
TYPE_TEXT_VARIATION_PASSWORD
AvariantofTYPE_CLASS_TEXTforenteringpasswords.The
inputmethodwilldisplaydingbatsinsteadoftheactualtext.
TYPE_TEXT_VARIATION_URI
AvariantofTYPE_CLASS_TEXTforenteringwebURLsand
otherUniformResourceIdentifiers(URIs).
TYPE_TEXT_FLAG_AUTO_COMPLETE
AvariantofTYPE_CLASS_TEXTforenteringtextthatthe
application"auto-completes"fromadictionary,search,orotherfacility.
RemembertomaskinputTypewiththeappropriate
constantwhenyoutestforthesevariants.Theavailablemaskconstantsarelistedinthe
referencedocumentationforInputType.
Caution:InyourownIME,makesureyouhandletextcorrectlywhenyousendit
toapasswordfield.HidethepasswordinyourUIbothintheinputviewandinthecandidates
view.Alsorememberthatyoushouldn'tstorepasswordsonadevice.Tolearnmore,seethe
DesigningforSecurityguide.
Sendtexttotheapplication
AstheuserinputstextwithyourIME,youcansendtexttotheapplicationbysending
individualkeyeventsorbyeditingthetextaroundthecursorintheapplication'stext
field.Ineithercase,youuseaninstanceofInputConnection
todeliverthetext.Togetthisinstance,call
InputMethodService.getCurrentInputConnection().
Editthetextaroundthecursor
Whenyou'rehandlingtheeditingofexistingtextinatextfield,someofthemoreuseful
methodsinBaseInputConnectionare:
getTextBeforeCursor()
ReturnsaCharSequencecontainingthenumberofrequestedcharacters
beforethecurrentcursorposition.
getTextAfterCursor()
ReturnsaCharSequencecontainingthenumberofrequestedcharacters
followingthecurrentcursorposition.
deleteSurroundingText()
Deletesthespecifiednumberofcharactersbeforeandfollowingthecurrentcursor
position.
commitText()
CommitaCharSequencetothetextfieldandsetanewcursor
position.
Forexample,thefollowingsnippetshowshowtoreplacethefourcharacterstotheleftofthe
cursorwiththetext"Hello!":
Kotlin
currentInputConnection.also{ic:InputConnection->
ic.deleteSurroundingText(4,0)
ic.commitText("Hello",1)
ic.commitText("!",1)
}
Java
InputConnectionic=getCurrentInputConnection();
ic.deleteSurroundingText(4,0);
ic.commitText("Hello",1);
ic.commitText("!",1);
Composingtextbeforecommitting
IfyourIMEdoestextpredictionorrequiresmultiplestepstocomposeaglyphor
word,youcanshowtheprogressinthetextfielduntiltheusercommitstheword,andthenyou
canreplacethepartialcompositionwiththecompletedtext.Youmaygivespecialtreatmentto
thetextbyaddinga"span"toitwhenyoupassitto
setComposingText().
Thefollowingsnippetshowshowtoshowprogressinatextfield:
Kotlin
currentInputConnection.also{ic:InputConnection->
ic.setComposingText("Composi",1)
ic.setComposingText("Composin",1)
ic.commitText("Composing",1)
}
Java
InputConnectionic=getCurrentInputConnection();
ic.setComposingText("Composi",1);
ic.setComposingText("Composin",1);
ic.commitText("Composing",1);
Thefollowingscreenshotsshowhowthisappearstotheuser:
Figure3.Composingtextbeforecommitting.
Intercepthardwarekeyevents
Eventhoughtheinputmethodwindowdoesn'thaveexplicitfocus,itreceiveshardwarekey
eventsfirstandcanchoosetoconsumethemorforwardthemalongtotheapplication.For
example,youmaywanttoconsumethedirectionalkeystonavigatewithinyourUIforcandidate
selectionduringcomposition.Youmayalsowanttotrapthebackkeytodismissanypopups
originatingfromtheinputmethodwindow.
Tointercepthardwarekeys,override
onKeyDown()
andonKeyUp().
Remembertocallthesuper()methodforkeysyoudon'twanttohandleyourself.
CreateanIMEsubtype
SubtypesallowtheIMEtoexposemultipleinputmodesandlanguagessupportedbyanIME.A
subtypecanrepresent:
Alocalesuchasen_USorfr_FR.
Aninputmodesuchasvoice,keyboard,orhandwriting.
Otherinputstyles,forms,orpropertiesspecifictotheIME,suchas10-keyorqwerty
keyboardlayouts.
Basically,themodecanbeanytextsuchas"keyboard","voice",andsoforth.Asubtypecan
alsoexposeacombinationofthese.
SubtypeinformationisusedforanIMEswitcherdialogthat'savailablefromthenotification
barandalsoforIMEsettings.Theinformationalsoallowstheframeworktobringupa
specificsubtypeofanIMEdirectly.WhenyoubuildanIME,usethesubtypefacility,because
ithelpstheuseridentifyandswitchbetweendifferentIMElanguagesandmodes.
Youdefinesubtypesinoneoftheinputmethod'sXMLresourcefiles,usingthe
element.ThefollowingsnippetdefinesanIMEwithtwo
subtypes:akeyboardsubtypefortheUSEnglishlocale,andanotherkeyboardsubtypeforthe
FrenchlanguagelocaleforFrance:
ToensurethatyoursubtypesarelabeledcorrectlyintheUI,use%stogetasubtypelabel
thatisthesameasthesubtype’slocalelabel.Thisisdemonstratedinthenexttwosnippets.
Thefirstsnippetshowspartoftheinputmethod'sXMLfile:
ThenextsnippetispartoftheIME'sstrings.xmlfile.Thestring
resourcelabel_subtype_generic,whichisusedbytheinputmethodUIdefinitionto
setthesubtype'slabel,isdefinedas:
%s
Thissettingcausesthesubtype’sdisplaynametomatchthelocalesetting.
Forexample,inanyEnglishlocale,thedisplaynameis“English(UnitedStates)”.
ChooseIMEsubtypesfromthenotificationbar
TheAndroidsystemmanagesallsubtypesexposedbyallIMEs.IMEsubtypesare
treatedasmodesoftheIMEtheybelongto.Inthenotificationbar,ausercanselectan
availablesubtypeforthecurrently-setIME,asshowninthefollowingscreenshot:
Figure4.ChoosinganIMEsubtypefromthenotification
bar.
Figure5.SettingsubtypepreferencesinSystemSettings.
ChooseIMEsubtypesfromSystemSettings
Ausercancontrolhowsubtypesareusedinthe“Language&input”settingspanelinthe
SystemSettingsarea.
Figure6.ChoosingalanguagefortheIME.
SwitchamongIMEsubtypes
YoucanallowuserstoswitcheasilyamongmultipleIMEsubtypesbyprovidingaswitchingkey,
suchastheglobe-shapedlanguageicon,aspartofthekeyboard.Doingsogreatlyimprovesthe
keyboard'susability,andcanhelpavoiduserfrustration.
Toenablesuchswitching,performthefollowingsteps:
DeclaresupportsSwitchingToNextInputMethod="true"intheinputmethod'sXML
resourcefiles.Yourdeclarationshouldlooksimilartothefollowingsnippet:
CalltheshouldOfferSwitchingToNextInputMethod()method.
Ifthemethodreturnstrue,displayaswitchingkey.
Whentheusertapstheswitchingkey,call
switchToNextInputMethod(),
passingfalsetothesecondparameter.Avalueoffalsetellsthesystemtotreatallsubtypes
equally,regardlessofwhatIMEtheybelongto.Specifyingtruerequiresthesystemtocycle
throughsubtypesinthecurrentIME.
Caution:PriortoAndroid5.0(APIlevel21),
switchToNextInputMethod()
isnotawareofthesupportsSwitchingToNextInputMethodattribute.Iftheuserswitches
intoanIMEwithoutaswitchingkey,theymaygetstuckinthatIME,unabletoswitchoutofiteasily.
GeneralIMEconsiderations
Herearesomeotherthingstoconsiderasyou'reimplementingyourIME:
ProvideawayforuserstosetoptionsdirectlyfromtheIME'sUI.
BecausemultipleIMEsmaybeinstalledonthedevice,provideawayfortheusertoswitchtoa
differentIMEdirectlyfromtheinputmethodUI.
BringuptheIME'sUIquickly.Preloadorloadondemandanylargeresourcessothatusers
seetheIMEassoonastheytaponatextfield.Cacheresourcesandviewsforsubsequent
invocationsoftheinputmethod.
Conversely,youshouldreleaselargememoryallocationssoonaftertheinputmethodwindowis
hidden,sothatapplicationscanhavesufficientmemorytorun.Considerusingadelayed
messagetoreleaseresourcesiftheIMEisinahiddenstateforafewseconds.
Makesurethatuserscanenterasmanycharactersaspossibleforthelanguageorlocale
associatedwiththeIME.Rememberthatusersmayusepunctuationinpasswordsoruser
names,soyourIMEhastoprovidemanydifferentcharacterstoallowuserstoentera
passwordandgetaccesstothedevice.
ContentandcodesamplesonthispagearesubjecttothelicensesdescribedintheContentLicense.JavaisaregisteredtrademarkofOracleand/oritsaffiliates.
Lastupdated2021-11-11UTC.
[{
"type":"thumb-down",
"id":"missingTheInformationINeed",
"label":"MissingtheinformationIneed"
},{
"type":"thumb-down",
"id":"tooComplicatedTooManySteps",
"label":"Toocomplicated/toomanysteps"
},{
"type":"thumb-down",
"id":"outOfDate",
"label":"Outofdate"
},{
"type":"thumb-down",
"id":"samplesCodeIssue",
"label":"Samples/codeissue"
},{
"type":"thumb-down",
"id":"otherDown",
"label":"Other"
}]
[{
"type":"thumb-up",
"id":"easyToUnderstand",
"label":"Easytounderstand"
},{
"type":"thumb-up",
"id":"solvedMyProblem",
"label":"Solvedmyproblem"
},{
"type":"thumb-up",
"id":"otherUp",
"label":"Other"
}]
Twitter
Follow@AndroidDevonTwitter
YouTube
CheckoutAndroidDevelopersonYouTube
MoreAndroid
Android
AndroidforEnterprise
Security
Source
News
Blog
Podcasts
Discover
Gaming
MachineLearning
Privacy
5G
AndroidDevices
Largescreens
WearOS
AndroidTV
Androidforcars
AndroidThings
ChromeOSdevices
Releases
Android11
Android10
Pie
Oreo
Nougat
Marshmallow
Lollipop
KitKat
DocumentationandDownloads
AndroidStudioguide
Developersguides
APIreference
DownloadStudio
AndroidNDK
Support
Reportplatformbug
Reportdocumentationbug
GooglePlaysupport
Joinresearchstudies
Android
Chrome
Firebase
GoogleCloudPlatform
Allproducts
Privacy
License
Brandguidelines
Getnewsandtipsbyemail
Subscribe
Language
English
BahasaIndonesia
Español–AméricaLatina
Português–Brasil
中文–简体
日本語
한국어