Police have detained two men for allegedly sending mobile phone text messages about race riots under a law that allows them to be held without trial.