Feat: dont call onStart() explicitly

This commit is contained in:
minhtrannhat 2023-11-05 18:13:12 -05:00
parent f19f09027f
commit fc7fb5bd88
Signed by: minhtrannhat
GPG Key ID: E13CFA85C53F8062

View File

@ -1,5 +1,6 @@
package com.example.coen390_assignment2.Views; package com.example.coen390_assignment2.Views;
import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
@ -68,6 +69,10 @@ public class MainActivity extends AppCompatActivity {
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
printStudentProfileList();
}
private void printStudentProfileList(){
List<StudentProfile> studentProfiles = studentProfileDBHelper.getAllStudentProfile(getApplicationContext()); List<StudentProfile> studentProfiles = studentProfileDBHelper.getAllStudentProfile(getApplicationContext());
// by default sort by surname // by default sort by surname
@ -128,14 +133,11 @@ public class MainActivity extends AppCompatActivity {
if (id == R.id.toggle_profiles_display_mode && toggle.getTitle() == "By ID") { if (id == R.id.toggle_profiles_display_mode && toggle.getTitle() == "By ID") {
profileNameDisplayMode = false; profileNameDisplayMode = false;
onStart(); printStudentProfileList();
return false; return false;
} else if (id == R.id.toggle_profiles_display_mode && toggle.getTitle() == "By Surname"){ } else if (id == R.id.toggle_profiles_display_mode && toggle.getTitle() == "By Surname"){
profileNameDisplayMode = true; profileNameDisplayMode = true;
printStudentProfileList();
onStart();
return false; return false;
} }