I have 2 files: main_activity.xml and home.xml. I made a button in main_activity.xml
Here is the code snippet:
For managing click activity in android ,you can do as below
Implement OnClickListener on YourActivity.java class like
public class MainActivity extends Activity implements OnClickListener
Then, declare your button in .java class like
Button btn = (Button) findViewById(R.id.btnPlay);
Then use button btn variable as below
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
myClick(v); /* my method to call new intent or activity */
}
});
Handle the click event:
public void myClick(View v) {
Intent intent = new Intent(**this, Swipe.class**);
startActivity(intent);// for calling the activity
}
you also need to register your activity(.java) in android manifest as below