androidxmlandroid-resources

android api resource qualifier - how to do ranges?


I need to set different menu options depending on the API level in android on the device. Specifically, for API 10 - 15 i need a specific menu and for API 16 and beyond i need another menu. My applications minSdkVersion is api 10.

Right now the menu resource structure looks like this:

res/menu/menu.xml       (Default)
res/menu-v10/menu.xml    
res/menu-v11/menu.xml
res/menu-v12/menu.xml
res/menu-v13/menu.xml
res/menu-v14/menu.xml
res/menu-v15/menu.xml

do i really have to add a menu item for each level or can i make it in a range.

I wish i could do this:

res/menu/menu.xml       (Default)
res/menu-v10-v15/menu.xml 

Is there a way to specify ranges in this way ? i do not see that in the docs


Solution

  • Is there a way to specify ranges in this way ?

    Not that way.

    do i really have to add a menu item for each level

    You don't.

    Specifically, for API 10 - 15 i need a specific menu and for API 16 and beyond i need another menu

    Then have two directories:

    This assumes that your minSdkVersion is 10.