Issue
I want to loop through ten Drawable resources named ab1, ab2 ab3,ab4,ab5 etc. and call a function on them.
b = decodeSampledBitmapFromResource(getResources(), R.drawable.ab1, reqHeight, reqWidth);
i am looking for something like this.
for(int i =1; i<11; i++)
{
b = decodeSampledBitmapFromResource(getResources(), R.drawable.ab[j], reqHeight, reqWidth);
}
How would I do that?
Solution
You can put those objects in list
list.add(R.drawable.ab1);
list.add(R.drawable.ab2);
list.add(R.drawable.ab3);
list.add(R.drawable.ab4);
.
.
.
and then you can iterate through that list, using list.get(i)
and pass each object in the method.
for(int i =1; i<11; i++)
{
b = decodeSampledBitmapFromResource(getResources(),list.get(i), reqHeight, reqWidth);
}
Answered By - Ninad Pingale
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.