The majority of scholars are of the view that it is makrooh to enter the toilet with anything in which Allaah is mentioned, except in cases of necessity, such as coins on which the name of Allaah is inscribed.
A number of scholars stated that if that is hidden, then there is nothing wrong with it in that case.
Ibn Qudaamah (may Allaah have mercy on him) said: If a person wants to enter the toilet and he has with him something in which Allaah is mentioned, it is mustahabb to put it aside… if he keeps the thing in which Allaah is mentioned with him and is careful not to let it fall, or he turns the stone of the ring towards the inside of his palm, there is nothing wrong with that. Ahmad said: If a ring has the name of Allaah on it and he turns it towards the inside of his palm, and enters the toilet (that is permissible). ‘Ikrimah said: He should turn it like this towards the inside of his palm, and fold his fist over it. This was also the view of Ishaaq, and the same concession was granted by Ibn al-Musayyib, al-Hasan and Ibn Sireen. Ahmad said concerning a man who enters the toilet carrying coins: I hope that there is nothing wrong with it. End quote from al-Mughni, 1/109
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked: what is the ruling on entering the washroom with papers on which there is the name of Allaah?
He replied: It is permissible to enter the washroom with papers on which is the name of Allaah, so long as they are in a pocket and are not out in the open, rather they are hidden and covered. End quote from Fataawa al-Tahaarah, p. 109
Based on this, there is nothing wrong with entering the toilet with a mobile phone on whose screen is the phrase “Allaahu akbar”, so long as you put it in your pocket, so that it is not out in the open.
And Allaah knows best.