mobile menu
Site icon
ZidsWorld

The Tech Galaxy

Live support

How to Stop,Close or Finish an Activity on Android Java Programmatically

Sunday, November 26, 2023, 2 PM

To close,stop or finish an activity, use this java code
// close this activity
 finish();
For example:
Intent i = new Intent(ThisActivity.this, NextActivity.class);
                startActivity(i);
                // close this activity
                finish();
This code here opens a new activity (NextActivity.class), then closes the Current Activity (ThisActivity.this). the code "finish();" does this.

Comments

No comments found.