Given that the foam moves, I would think a more flexible glue like silicon would provide better results.
One last consideration is that some glues have difficulty adhering to other glues. Cleaning the surfaces to be glued may be important. (For example, super glue will not adhere to super glue)
Violinist.com is made possible by...
Dimitri Musafia, Master Maker of Violin and Viola Cases
Johnson String Instrument/Carriage House Violins
Discover the best of Violinist.com in these collections of editor Laurie Niles' exclusive interviews.
Violinist.com Interviews Volume 1, with introduction by Hilary Hahn
Violinist.com Interviews Volume 2, with introduction by Rachel Barton Pine
(You can just get 100% silicone caulk from a home improvement store)