I am trying to set a toggle button that will enable and disable notification for the app i am building. The current code i have it set up for an old password field as I was using thenewboston Android Tutorial. This is My Current Code:
package com.example.smartfood;
import android.app.Activity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.ToggleButton;
public class Settings extends Activity {
Button chkCmd;
ToggleButton notTog;
EditText input;
TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.text);
notTog = (ToggleButton) findViewById(R.id.tbResult);
display = (TextView) findViewById(R.id.tbResult);
notTog.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (notTog.isChecked()){
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}else{
input.setInputType(InputType.TYPE_CLASS_TEXT);
}
}
});
}
}
any help would be greatly appreciated