I\'ve added a button to my activity XML file and I can\'t get it to open my other activity. Can some please tell me step by step on how to do this?
Write code on xml file.
Write Code in your java file
Button button=(Button)findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
startActivity(new Intent(getApplicationContext(),Secondclass.class));
/* if you want to finish the first activity then just call
finish(); */
}
});