Skip to content

Instantly share code, notes, and snippets.

@patrykpoborca
Created October 13, 2015 14:19
Show Gist options
  • Save patrykpoborca/0458ec43fdcbff11270d to your computer and use it in GitHub Desktop.
Save patrykpoborca/0458ec43fdcbff11270d to your computer and use it in GitHub Desktop.
public class MockedResources extends Resources{
private Map<Integer, String> stringMap;
public MockedResources(){
this(null, null, null);
}
public MockedResources(AssetManager assets, DisplayMetrics metrics, Configuration config) {
super(assets, metrics, config);
stringMap = new HashMap<>(1);
}
public void addString(int id, String value){
stringMap.put(id, value);
}
@NonNull
@Override
public String getString(int id) throws NotFoundException {
return stringMap.get(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment