How to use dynamicToolbarColor() in android -


following code getting 1 image resource, how change dynamic images, i'm getting images bitmap.

    bitmap bitmap = bitmapfactory.decoderesource(getresources(),             r.drawable.pfpic);      palette.from(bitmap).generate(new palette.paletteasynclistener() {          @override         public void ongenerated(palette palette) {             collapsingtoolbarlayout.setcontentscrimcolor(palette.getmutedcolor(r.attr.colorprimary));             collapsingtoolbarlayout.setstatusbarscrimcolor(palette.getmutedcolor(r.attr.colorprimarydark));         }     }); } 

you converting 1 image, mentioned getting images in form of bitmaps right?!, why don't use bitmap reference?!.

    bmp = bitmapfactory.decodebytearray(b, 0, b.length);                 imageview.setimagebitmap(bmp); 

you can use 'bmp' in following code this

    palette.from(bmp).generate(new palette.paletteasynclistener() { 

Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

file - Python: AttributeError: 'str' object has no attribute 'readlines' -

c# - Get the Class name in a class with atribute inside a attribute method -