I am using a Button created using following code
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
Button btn = new Button(this);
btn.setOnClickListener(newtodobtn);
btn.setText("New Todo");
btn.setBackgroundDrawable(new Button(this).getBackground());
ll.addView(btn);
I have an image in path @drawable/new_todo_image to set as background for the button. How to set it to the Button programmatically?
for set background image for button which is in drawable folder then use below code