সীমাবদ্ধতা API

Different cars can allow for differing numbers of Item instances to be displayed to the user at a time. Use the ConstraintManager to check the content limit at runtime and to set the appropriate number of items in your templates.

CarContext থেকে একটি ConstraintManager পান:

কোটলিন

val manager = carContext.getCarService(ConstraintManager::class.java)

জাভা

ConstraintManager manager = getCarContext().getCarService(ConstraintManager.class);

Query the retrieved ConstraintManager object for the relevant content limit. For example, to get the number of items that can be displayed in a grid, call getContentLimit with CONTENT_LIMIT_TYPE_GRID :

কোটলিন

val gridItemLimit = manager.getContentLimit(ConstraintManager.CONTENT_LIMIT_TYPE_GRID)

জাভা

int gridItemLimit = manager.getContentLimit(ConstraintManager.CONTENT_LIMIT_TYPE_GRID);