activity to fragment on button click


//fragment name is Blankfragment
//id inside main acitiy is continer

btnGetSatus = findViewById(R.id.buttonGetStatus);

btnGetSatus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

BlankFragment fragment = new BlankFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.container, fragment);
transaction.commit();

}
});