In my application I have a background thread for uploading/downloading files. While file is being downloaded user can switch between couple of application activities. When download ends I want to inforn the user about that but I don't know how I can get active activity to call showAlert() method. Is there any way to get current activity reference from background thread ?
you could use a Handler to do so (some how make the MainActivity accessible from the background Thread, easy to do if you create the within that MainActivity, because then you can use the this-Pointer of the MainActivity):