ok I think I got it
listPreference.setEntries(entries)
listPreference.setEntryValues(entryValues)
where entries and entryValues can be
CharSequence[] entries = {'Entry 1','Entry 2','Entry 3','Entry 4'};
CharSequence[] entryValues= {0,1,2,3};
source
share