So I have these Codes here, It runs without crashing. However When I pass \"this\" into the gridadapter the mContext is null. I tried to pass getApplicationContext() through but
I think mContext
is not null, but the getResources() method return null.
Change your code like below and try again, if it doesn't work. Paste the Logcat and we can debug the code.
String[] list = mContext.getResources().getStringArray(R.array.championlist);
and:
public int[] getImage() {
int[] tempImage = new int[list.length];
for (int i = 0; i < list.length; i++) {
tempImage[i] = mContext.getResources().getIdentifier(list[i],
"drawable", getPackageName());
}
return tempImage;
}