title: Android Toggle Button not working properly for Password Field
body: <p>When I Click on the Toggle Button, it changes the Password field to Normal looking Text, But when I click on it Again, It doesnt change the Text field to Password Type back. Why is that so ?</p>
  
  <p>Here is my code, </p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
  
  // TODO Auto-generated method stub
  
  super.onCreate(savedInstanceState);
  setContentView(R.layout.text);
  chkcmd = (Button) findViewById(R.id.but3);
  passtog = (ToggleButton) findViewById(R.id.tb1);
  input = (EditText) findViewById(R.id.et1);
  display = (TextView) findViewById(R.id.tv2);
  passtog.setOnClickListener(new View.OnClickListener() {
  
  @Override
  public void onClick(View V) {
  // TODO Auto-generated method stub
  
  if(passtog.isChecked())
  {
  input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
  }
  
  else if(!passtog.isChecked())
  {
  input.setInputType(InputType.TYPE_CLASS_TEXT);
  }
  }
  });
  </code></pre>