Turning ImageButton to toggled one

Was trying to make ImageButton s “toglable”. Recipes are everywhere and I made such program: https://github.com/dims12/TryInvestigateButtonUnpress

It shows “pressed” button by

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ButterKnife.bind(this);

    someButton.setSelected(true);
}

And looks the following way:

xboofaf

Unfortunately, once I press “Home” button on the device, button turns unpressed. This happens even before application actually minimizes.

The solution for this appeared simple: I was to simulated toggle not with “pressed”, but with “selected” attribute.