0

I try to set bitmap image from drawable that i declare on resource.java. When i click next button,it will show another image that i can draw. Is this right code to call it?

bmp = BitmapFactory.decodeResource(getResources(), Resource.capitalStoke[DrawingActivity.this.position]);

or anymore to add?

this is my resource.java:

public class Resource {

    public static String DRAWING_ALPHABET;
    public static Integer[] capitalStoke;
    Integer[] alphabetCapital;
    Integer[] alphabetSound;
    Integer[] alphabetImage;

    static {
        DRAWING_ALPHABET = "alphabet";
        capitalStoke = new Integer[]{Integer.valueOf(R.drawable.capital_letters_stroke_01),
                                     Integer.valueOf(R.drawable.capital_letters_stroke_02),
                                     Integer.valueOf(R.drawable.capital_letters_stroke_03),};
        }

is that possible to retrieve image from here using bitmapfactory?if possible,how should i do it?

1 Answers1

0

It's right following to this How to set a bitmap from resource.

In my opinion better idea is to use it in common way - just constants like R.id.drawable_1;. You can always store followings ids in array or list to iterate.

Community
  • 1
  • 1
Krystian Kaniowski
  • 1,959
  • 17
  • 33