@@ -76,6 +76,8 @@ public static interface OnCategoriesSaveHandler {
76
76
77
77
protected HashMap <String , ArrayList <String >> categoriesCache ;
78
78
79
+ private ArrayList <String > selectedCategories = new ArrayList <String >();
80
+
79
81
// LHS guarantees ordered insertions, allowing for prioritized method A results
80
82
private final Set <String > results = new LinkedHashSet <String >();
81
83
PrefixUpdater prefixUpdaterSub ;
@@ -584,7 +586,7 @@ public void onSaveInstanceState(Bundle outState) {
584
586
public boolean onOptionsItemSelected (MenuItem menuItem ) {
585
587
switch (menuItem .getItemId ()) {
586
588
case R .id .menu_save_categories :
587
- ArrayList < String > selectedCategories = new ArrayList < String >();
589
+
588
590
int numberSelected = 0 ;
589
591
590
592
for (CategoryItem item : categoriesAdapter .getItems ()) {
@@ -594,9 +596,6 @@ public boolean onOptionsItemSelected(MenuItem menuItem) {
594
596
}
595
597
}
596
598
597
- //Need to reassign to a final variable to use in inner class
598
- final ArrayList <String > finalCategories = selectedCategories ;
599
-
600
599
//If no categories selected, display warning to user
601
600
if (numberSelected == 0 ) {
602
601
AlertDialog .Builder builder = new AlertDialog .Builder (getActivity ());
@@ -612,7 +611,7 @@ public void onClick(DialogInterface dialog, int id) {
612
611
builder .setNegativeButton ("Yes, submit" , new DialogInterface .OnClickListener () {
613
612
public void onClick (DialogInterface dialog , int id ) {
614
613
//Proceed to submission
615
- onCategoriesSaveHandler .onCategoriesSave (finalCategories );
614
+ onCategoriesSaveHandler .onCategoriesSave (selectedCategories );
616
615
return ;
617
616
}
618
617
});
@@ -621,7 +620,7 @@ public void onClick(DialogInterface dialog, int id) {
621
620
dialog .show ();
622
621
} else {
623
622
//Proceed to submission
624
- onCategoriesSaveHandler .onCategoriesSave (finalCategories );
623
+ onCategoriesSaveHandler .onCategoriesSave (selectedCategories );
625
624
return true ;
626
625
}
627
626
}
0 commit comments