in my application i'm create simple dialog class to use it every where in application. after re-open application and show this dialog i get error, but i'm wondering after waiting some second i dont get problem
Error:
E/WindowManager﹕ Activity ir.jaziire.app.porseman.ActivityHome has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{411d8b20 V.E..... R......D 0,0-640,236} that was originally added here
android.view.WindowLeaked: Activity ir.jaziire.app.porseman.ActivityHome has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{411d8b20 V.E..... R......D 0,0-640,236} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:424)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:218)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:281)
at ir.jaziire.Classes.ProgressDialog.showDialog(ProgressDialog.java:33)
my simple dialog class:
public class ProgressDialog {
private Context mContext;
private Dialog dialog;
private String dialogMessage = "";
private boolean setCancelable = false;
private boolean setCanceledOnTouchOutside = false;
public ProgressDialog() {
}
public ProgressDialog(Context context) {
mContext = context;
dialog = new Dialog(mContext, R.style.theme_sms_receive_dialog);
dialog.setContentView(R.layout.progress_dialog);
dialog.setCancelable(setCancelable);
dialog.setCanceledOnTouchOutside(setCanceledOnTouchOutside);
}
public void showDialog(){
TextView tv_progress_title = (TextView) dialog.findViewById(R.id.tv_progress_title);
tv_progress_title.setText(dialogMessage);
dialog.show();
}
public void dismissDialog(){
dialog.dismiss();
}
public ProgressDialog setMessage(String message){
dialogMessage = message;
return this;
}
public ProgressDialog setCancelable(boolean state){
setCancelable = state;
return this;
}
public ProgressDialog setCanceledOnTouch(boolean state){
setCanceledOnTouchOutside = state;
return this;
}
}
i'm using this class with way:
public class FragmentViewAllSubjects extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
............
G.currentActivity = FragmentViewAllSubjects.this.getActivity();
ProgressDialog mProgressDialog = new ProgressDialog(G.currentActivity)
.setCancelable(false).setCanceledOnTouch(false);
mProgressDialog.setMessage(UC.getResourcesText(R.string.connection_to_server));
mProgressDialog.showDialog();
0 comments:
Post a Comment