have a try the below codes:

for(string s: selections){
    if("movies-checked".equals(s)) {
    if("test-checked".equals(s)) {
    if("test23-checked".equals(s)) {


it stores only the ones that are checked.

you can put values ​​as indices.

<string-array name="catos">
    <item >movies</item>
    <item >test</item>
    <item >test23</item>
<string-array name="catovalues">
    <item >0</item>
    <item >1</item>
    <item >2</item>

0 - movies => checked 
1 - test   => unchecked 
2 - test23 => checked 

in the preferences file will only indexes 0 and 2, and you can assume that others are unmarked.

so if you analyze the set <string>, its size will be only 2 strings with 0 and 2.

Related Query

More Query from same tag