Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi guys . iam working on my project and have a little problem . i'v created a class . this class contains some Methods . one of these methods is used to show a progress Dialog .in fact iv created this class becaus of reuse
. i'd like to use this class from another Activity .like association relationship in oop .
fact : as you know if you hav an object of a class inside another class , these classes have association relationship .
My Class
Java
import android.app.ProgressDialog;
import android.content.Context;
public class MyProgress  {
      ProgressDialog dialog;
      public void showProgBox(Context ctx,String Title, String Txt ){		
	dialog=ProgressDialog.show(ctx, Title, Txt);
	}
       }


but when i use this method from another Activity i get an error
error :
android.view.windowManagerBadTokenException--token null is not for application
Activity's Code :
Java
MyProgress Mp=new MyProgress();
Mp.showProgBox(getBaseContext(), "Loading Box ", "wait...");

i debugged my app . i think the problem is about getBaseContext()
what would you suggest doing ?! thank you ...
Posted
Updated 27-Jan-15 3:01am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900