I'm trying to fill imageViews dynamicly with this code:
inventorySpace[i].setImageResource((getResourceId(testimg, "mipmap", getPackageName())));
but it doenst work, if I do this it does work: inventorySpace[i].setImageResource(R.mipmap.testimg);
this is the getResourceID method:
public int getResourceId(String pVariableName, String pResourcename, String pPackageName)
{
try
{
retu getResources().getIdentifier(pVariableName, pResourcename, pPackageName);
} catch (Exception e)
{
e.printStackTrace();
retu -1;
}
}
the method does work with filling textviews dynamicly so I don't think its the method
