Android Question Statelist Drawable - multiple copies

Discussion in 'Android Questions' started by Rusty, Jul 9, 2015.

  1. Rusty

    Rusty Well-Known Member Licensed User

    I have an array of buttons and am assigning them as Statelistdrawable. In order for each button to respond uniquely, i have to create an array of SLD definitions.
    Question: Since i am creating an array of SLD, are the bitmaps that are contained in the SLD also duplicated in memory for each SLD? Or do the SLD's store a reference to the bitmap(s), thus no huge amount of memory is used for the array?
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can and should reuse the bitmaps. StateListDrawable by itself will not clone the bitmap. Your code should avoid loading the bitmaps more than once.
  3. Rusty

    Rusty Well-Known Member Licensed User

    ...Exactly what I wanted to hear :)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice