I have a method that I only want to have called when not on the main thread (does heavy work) and if it is called from the main thread I would throw a runtime exception, similar to what happens when you try to do a network call on the main thread and you get a NetworkOnMainThreadException
I have not found anything on this issue so is there a way to do it?