Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think</p> <pre><code>Button btnOpenPopup = (Button)findViewById(R.id.polarity); btnOpenPopup = (Button) findViewById(R.id.color); </code></pre> <p>should be</p> <pre><code> Button btnOpenPopupFirst = (Button)findViewById(R.id.polarity); Button btnOpenPopupSecond = (Button) findViewById(R.id.color); </code></pre> <p>you should declare different different button for diffrerent findviewbyid</p> <p>also in my eclipse it is not accepting</p> <pre><code>btnOpenPopup.setOnClickListener(new Button.OnClickListener() </code></pre> <p>instead it works with </p> <pre><code>btnOpenPopup.setOnClickListener(new View.OnClickListener() {} </code></pre> <p>and you need to provide more clear view of what you want to perform</p> <p>new thoughts,try doing this:</p> <pre><code> btnOpenPopupFirst.setOnClickListener(this); btnOpenPopupSecond.setOnClickListener(this); </code></pre> <p>then option will come on both the above code lines </p> <pre><code>The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (MainActivity) </code></pre> <p>choose this </p> <pre><code>let MainActivity implement OnClickListener </code></pre> <p>then this option will come</p> <pre><code>The type MainActivity must implement the inherited abstract method View.OnClickListener.onClick(View) </code></pre> <p>choose </p> <pre><code>add unimplemented method </code></pre> <p>now </p> <pre><code>@Override public void onClick(View v) </code></pre> <p>will be created</p> <pre><code>@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.polarity: Toast.makeText(getApplicationContext(), "btnOpenPopupFirst(polarity) is pressed", Toast.LENGTH_SHORT).show(); //other code to be performed regarding this button break; case R.id.color: Toast.makeText(getApplicationContext(), "btnOpenPopupSecond(color) is pressed", Toast.LENGTH_SHORT).show(); //other code to be performed regarding this button default: break; } } </code></pre> <p>And post your views after implementing this way.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload