I take it you're looking for something a little more scalable than the
naive solution:

switch (input) {
    case 1:
        return R.drawable.pic_1;
    . . .
    case n:
        return R.drawable.pic_n;
}

I see the problem; you need to append an arbitrary number to the end
of a string, and then turn that into the R.drawable. ___ reference.
I'm stumped

On Oct 5, 11:08 pm, wine <[email protected]> wrote:
> hi,
>
> I have met an issue.
> There are some pics in the res/drawable named as pic_1.png, pic_2.png,
> pic_3.png, pic_4.png.... I want to load someone according to the
> input.
> For instance, if I input 2, I want to load pic_2.png. If input 3, will
> load the pic_3.png....
> How to achieve? Need your expert help here...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to