title: I am trying to display a toast when this button is pressed. But the code is not working
body: <pre><code>public class MainActivity extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
  
      Button btn = (Button) findViewById(R.id.button1);
      btn.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              EditText text = (EditText)findViewById(R.id.editText1);
              EditText text1 = (EditText)findViewById(R.id.editText2);
              String userid = text.getText().toString();
              String pass = text1.getText().toString();
          Toast.makeText(getBaseContext(),"Entered"+userid+"and password entered is"+pass,Toast.LENGTH_SHORT).show();
          }
  
      });
  
  }
  </code></pre>
  
  <p>The code executes successfully, but nothing happens when the button is pressed. 
  When I focus on the line in eclipse it says the following</p>
  
  <pre><code>"The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (new 
   View.OnClickListener(){}, String, int)"
  </code></pre>
  
  <p>Please tell me what do i require to do to make it work</p>