I put a button on activity_main
and made a second screen.
The idea was to click the button to load that other screen. And in class MainActivity.java
I put it on clicking the button, it would load the screen.
However, clicking the button does not happen at all.
Does anyone have any idea what it can be?
public class MainActivity extends Activity {
Button btCadastro;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btCadastro = (Button) findViewById(R.id.btCadastro);
btCadastro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
chamaCadastro();
}
});
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
public void chamaCadastro(){
setContentView(R.layout.telacadastro);
}