MyButtonListener cannot be resolved to a type

public class MainActivity extends Activity {
Button myButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
myButton=(Button)findViewById(R.id.myButton);
myButton.setText("Button");
myButton.setOnClickListener(new MyButtonListener());

    /*if (savedInstanceState == null) {
        getFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }*/
 class MyButtonListener implements OnClickListener{

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Intent intent=new Intent();
        intent.setClass(MainActivity.this, OtherActivity.class);
        MainActivity.this.startActivity(intent);
    }

 }

}