I want to use
private static final Random rgenerator = new Random();
Resources res = getResources();
myString = res.getStringArray(R.array.xmlString);
String q = myString[rgenerator.nextInt(myString.length)];
When i use the same in an activity it works fine, but if i use in AppWidget class it throws an error in getResources();
is there any way to use this in AppWidget, basically all i want is to get random xml strings to appWidget, is there any workaround for this?