Last active
April 29, 2017 12:21
-
-
Save smaugho/85da5b103f681391d489058ee3b1b7cf to your computer and use it in GitHub Desktop.
Multi-Threading Control with Actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Model | |
@Populate | |
List<Item> itemsList; | |
void sortAndUpdateItemsList() { | |
//This will run the following code in an Asynchronous (Background) Thread | |
$Background(); | |
Collections.sort(itemsList, | |
new Comparator<Item_>(){ | |
public int compare(Item_ item1, Item_ item2) { | |
return item1.getName().compareTo(item2.getName()); | |
} | |
} | |
); | |
//This will run the following code in the Main (UI) Thread | |
$UIThread(); | |
$Populate(itemsList); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment