خرید بک لینک

Vote count: 0

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

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 13 خرداد 1395 ساعت: 21:39

صفحه بندی