In my android XML Graphical Layout, it can not display my ToggleButton. I get some errors (see below). I have checked all other components in the Palette window
I think you can use this code
togglebut.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String text = togglebut.getText().toString();
Toast.makeText(MainActivity.this, "" + text, Toast.LENGTH_SHORT).show();
textView.setText(text);
}
});
for more info Click [here](http://androidcoding.in/2016/09/11/android-tutorial-toggle-button/"Android Toggle Button")