Q. A non-Jewish co-worker gave me as a present his last year model tablet when he bought a new one, which is far better than the one I have. I use mine for learning the Daf and for davening Mincha, since we don’t have enough sidurim at the mincha minyan. When I was clearing out his files I noticed that he was downloading highly improper material. After having erased all of it, is it correct to use this tablet for learning and davening?

A. The Gaon (Oros Hagro) mentions that if one would build a shul where even the building tools were fashioned with the right kavana, no one would pray there with the wrong intention. This being similar to Rav Chias statement (Bava Metzia 85b) on planting the flax seeds to make the nets etc… and write the books, all done with the proper mind set in order to guarantee that the Torah will never be forgotten.
Maharam Shik (O.H. 41) rules that one should not daven in a shul that was constructed by chilul Shabbos, even if it means to daven without a minyan and lose Kadish, Kedusha and Torah reading.
Igrois Moishe (O.H. 2: 17) prohibits davening from a sidur that was printed by desecrating Shabbos, as the tefilos will not be accepted. He debates whether he complies even after the fact. He also mentions that no Siato Dishmaya or heavenly help will be granted to one that learns from such a sefer.
Similarly, Sefer Chasidim (249) mentions that the tefilos recited while using a sidur that was written by a rasha or evil person will not be accepted.
However, Horav Shlomo Miller’s Shlit”a opinion is that even if Gentiles are also forbidden to watch immoral material, (Hashchosas zera is prohibited to them as in the Mabul,) there is a difference between a sidur or sefer that was written or printed in a prohibited manner and one that was created correctly but then used temporarily in a forbidden way. Otherwise, he argues, the printing press could also have been used to print immoral material; still it would not prohibit what was afterwards printed correctly. Horav Shmuel Kamenetzky Shlit “a gave a similar ruling.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a