Hi, in my Android app I've got two activities, lets say A and B. A is the main activity, and it calls Activity B like so:
Intent myIntent = new Intent(getBaseContext(), B.class);
A.this.startActivity(myIntent);
And this works fine. The back button on the phone works to return to activity A, but I want to put a button on the UI as well. So I have a "Cancel" button in Activity B's layout file, and I have the following code in Activity B's java.
public void onClick(View arg0) {
if (arg0.getId() == R.id.btn_cancel) {
B.this.finish();
}
}
However, clicking the button doesn't cause anything to happen at all. Any insight? Thanks a ton!