Problem with setBackgroundResource() in library project
I am having trouble getting setBackgroundResource() to work.
Here is the code snippet. **Note that the following code is in a library project**.

    ImageButton icon = new ImageButton(mActivity);
    LayoutParams lpIcon = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    icon.setLayoutParams(lpIcon);
    icon.setImageResource(iconResId);
    icon.setBackgroundResource(R.drawable.bg_menu_item);

**Note:** R.drawable.bg_menu_item is a state drawable.

With above code I am not able to get the state drawable to work. It just doesn't work. Am I missing something or doing something wrong?
Problem with setBackgroundResource() in library project
===

I am having trouble getting setBackgroundResource() to work.
Here is the code snippet. **Note that the following code is in a library project**.

    ImageButton icon = new ImageButton(mActivity);
    LayoutParams lpIcon = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    icon.setLayoutParams(lpIcon);
    icon.setImageResource(iconResId);
    icon.setBackgroundResource(R.drawable.bg_menu_item);

**Note:** R.drawable.bg_menu_item is a state drawable.

With above code I am not able to get the state drawable to work. It just doesn't work. Am I missing something or doing something wrong?