10 years ago
I'd just get a 2 part epoxy and just pour it on.
In the electronics industry, usually they use RTV Silicone. It firmly holds the parts, is resistant to temperature changes, and remains flexible.
But, a dab of hot glue should be fine.
A dab or epoxy or polyurethane glue(it foams up a bit) would do the trick. Only if you want a permanent mount. Water based glues may not be good because they have water in them and will not really stick to slick surfaces like metal or plastic.
if the parts don't get hot, you could try a hot glue gun.