What do you mean by "language of the phone"? Do you want to set the system default language in code?
If you only wanted to change the language of your app temporarily, you could do that by including language-specific resource folders and files (which I find cumbersome), or just have your app access a set of appropriate messages according to the desired language. I often store messages in several languages in a map, which is filled depending on the system default language of the phone (queried at startup, but you could change that at any time).
If you want to change the system default language, I don't know how that could work.
Regards,