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
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 :
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 ...