Skip to content

Commit

Permalink
MainActivity javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimin15 committed Apr 27, 2024
1 parent a5b090f commit 32a1468
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions app/src/main/java/com/example/proj2/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@
import android.view.Menu;
import android.view.MenuItem;

/**
* MainActivity class representing the main activity of the application.
*/
public class MainActivity extends AppCompatActivity {

private AppBarConfiguration appBarConfiguration;
private ActivityMainBinding binding;

/**
* Called when the activity is starting. This is where most initialization should go.
*
* @param savedInstanceState If the activity is being re-initialized after previously being shut down
* then this Bundle contains the data it most recently supplied in
* onSaveInstanceState(Bundle). Note: Otherwise it is null.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -46,13 +56,26 @@ public void onClick(View view) {
});
}

/**
* Initialize the contents of the Activity's standard options menu.
*
* @param menu The options menu in which you place your items.
* @return You must return true for the menu to be displayed;
* if you return false it will not be shown.
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

/**
* Called whenever an item in the options menu is selected.
*
* @param item The menu item that was selected.
* @return Return false to allow normal menu processing to proceed, true to consume it here.
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
Expand All @@ -68,6 +91,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}

/**
* Navigate up within the activity's navigation hierarchy.
*
* @return True if Up navigation completed successfully and this Activity was finished,
* false otherwise.
*/
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
Expand Down

0 comments on commit 32a1468

Please sign in to comment.