For example, if you want only high priority messages to appear in
the message list, you can change the code to the
following:
// Display high priority messages only.
ArrayList<Message> filteredMessages = MessageDb.getMessages( bCompleteList );
for( int iMessageIndex = 0; iMessageIndex < filteredMessages.size(); iMessageIndex++ )
{
if( filteredMessages.get(iMessageIndex).getMailPriority() != com.sybase.mo.AmpConsts.EMAIL_STATUS_IMPORTANCE_HIGH )
{
filteredMessages.remove(iMessageIndex);
//we need to decrement the index so we don't skip an element now
iMessageIndex--;
}
}
return filteredMessages;
You must
refresh the listview before the new messages are filtered. You can refresh the
listview by switching to another view and then switching back.