0

I have two layouts - activity_main.xml and select.xml(transparent). In my MainActivity class I have:

setContentView(R.layout.activity_main);

and after that:

view = View.inflate(MainActivity.this, R.layout.select, null);

btnPrev = (ImageButton) view.findViewById(R.id.btnPrev);
btnNext = (ImageButton) view.findViewById(R.id.btnNext);
btnOk = (ImageButton) view.findViewById(R.id.btnOk);

btnPrev.setOnClickListener(this);
btnNext.setOnClickListener(this);
btnOk.setOnClickListener(this);

And the buttons appear but seem to do nothing. The onClick() method is fully implemented so I think there is something wrong in mixing the two layouts (select.xml is on top of activity_main.xml). Any advice?

EDIT: This image(select.xml): enter image description here

Should be on top of this image(activity_main.xml):enter image description here

When a menu item "select" is clicked.

public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.whistle_change:
            Intent a = new Intent(this, WhistleSelect.class);
            startActivity(a);
            break;
        case R.id.exit:

            break;
    }

    return false;

}
Mark Adler
  • 101,978
  • 13
  • 118
  • 158
Nikola
  • 890
  • 1
  • 11
  • 35

0 Answers0