Skip to content

How to change StartDrawable and EndDrawable res programly? #43

@Kolyall

Description

@Kolyall

I tried:

 mButton.setStartDrawable(VectorDrawable.getDrawable(this, R.drawable.ic_play));
 mButton.setEndDrawable(VectorDrawable.getDrawable(this, R.drawable.ic_pause));

Error is:

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Rect android.graphics.drawable.Drawable.getBounds()' on a null object reference

I tried:

 mButton.setStartDrawable(AnimatedVectorDrawable.getDrawable(this, R.drawable.ic_play_animatable));
 mButton.setEndDrawable(AnimatedVectorDrawable.getDrawable(this, R.drawable.ic_pause_animatable));

Error is:

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Rect android.graphics.drawable.Drawable.getBounds()' on a null object reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions