I would like to click a save button and go to a different layout file(layout_save).
I got an error message on the Button.on Click Listener() and says that con not be resolve to a type.
Here is my codes;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_final_project);
Button buttonOne = (Button) findViewById(R.id.button1);
buttonOne.setOnClickListener(new Button.onClickListener(){
public void onClick(view v){
setContentView(R.layout.layout_save);
}
});
You don’t have to specify the instance of the onclicklistener inside the setOnClickListener method. All you need to do is just instantiate a new on click listener like this.
The onclicklistner already knows what instance it is from the set method.