Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android determine if activity context or application context

Tags:

android

I have an async task that makes an upload and shows a progress dialog. I would like to be able to not show the dialog if it is being called by a service and thus can't show a dialog. The problem is there a way to determine which type of context i have(an activity or an application) ?

like image 974
max4ever Avatar asked Nov 27 '12 15:11

max4ever


1 Answers

 if( context instanceof Activity ) {
    //...
 } else {
    //...
 }
like image 129
Snicolas Avatar answered Oct 05 '22 07:10

Snicolas