According to the restriction entry types, for defining a list of objects we should use the bundle_array
type, and an example follows:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android" >
<restriction
android:key="vpn_configuration_list"
android:restrictionType="bundle_array">
<restriction
android:key="vpn_configuration"
android:restrictionType="bundle">
<restriction
android:key="vpn_server"
android:restrictionType="string"/>
<restriction
android:key="vpn_username"
android:restrictionType="string"/>
<restriction
android:key="vpn_password"
android:restrictionType="string"/>
</restriction>
</restriction>
</restrictions>
In code that would be similar to a List<VpnConfiguration>
, and VpnConfiguration
would be a pojo with the three fields vpn_server
, vpn_username
, and vpn_password
.
So far so good, now imagine that a simpler data structure is needed, like a String[]
.
According to Test DPC this should be possible, because there's an option to insert an array of strings:
Once you select it, then you are prompted to enter the list of values. However, the documentation does not have a string_array
type, it has only the bundle_array
.
With bundle_array
you can define a List<String>
instead of String[]
, but that is overkill:
<restriction
android:key="mylist"
android:restrictionType="bundle_array">
<restriction
android:key="item"
android:restrictionType="bundle">
<restriction
android:key="name"
android:restrictionType="string" />
</restriction>
</restriction>
So, is there a simpler way one can define a string array?