나는 구글을 통해 보았다하지만"누출 된 창"을 없애는 방법?
내가 뭐하는 거지Activity com.fittingroom.newtimezone.view.ActivityAcceptNotAccept has leaked window com.android.internal.policy.PhoneWindow$DecorView{57b68a6 V.ED..... R......D 0,0-324,534} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:565)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:326)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.app.Dialog.show(Dialog.java:350)
at com.fittingroom.newtimezone.view.ActivityAcceptNotAccept.openProgress(ActivityAcceptNotAccept.java:125)
at com.fittingroom.newtimezone.presenters.PresenterActivityAcceptNotAccept.openProgress(PresenterActivityAcceptNotAccept.java:125)
at com.fittingroom.newtimezone.presenters.PresenterActivityAcceptNotAccept.access$000(PresenterActivityAcceptNotAccept.java:16)
at com.fittingroom.newtimezone.presenters.PresenterActivityAcceptNotAccept$1.onPreExecute(PresenterActivityAcceptNotAccept.java:35)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
at android.os.AsyncTask.execute(AsyncTask.java:551)
at com.fittingroom.newtimezone.presenters.PresenterActivityAcceptNotAccept.setCroppedPreviewImage(PresenterActivityAcceptNotAccept.java:51)
at com.fittingroom.newtimezone.view.ActivityAcceptNotAccept.accept(ActivityAcceptNotAccept.java:63)
at java.lang.reflect.Method.invoke(Native Method)
at android.view.View$DeclaredOnClickListener.onClick(View.java:4735)
at android.view.View.performClick(View.java:5697)
at android.view.View$PerformClick.run(View.java:22526)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
, 난 그냥 진행 상황을 만들어 내 오류 로그는 내 문제와 관련된 does't 발견 한 모든 해답있다 ... 대화와 assynk 작업의 설정 제어하에 및 onPreExecute()
대화 상자에서이 onPostExecute()
대화 상자에서 그러므로 열고되어
public final class ActivityAcceptNotAccept extends Activity implements IActivityAcceptNotAccept {
private Dialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accept_not_accept);
...///
presenter.initView();
}
...///
@Override
public void initView() {
progressDialog = UtilClass.getDialog(ActivityAcceptNotAccept.this, getString(R.string.loading));
}
public final void accept(View view) {
switch (count) {
case firstClick:
presenter.setCroppedPreviewImage();
break;
case secondClick:
presenter.setResultOkAndFinishActivity();
break;
}
}
@Override
public void setDisplaySize() {
UtilClass.setDisplaySize(getWindowManager().getDefaultDisplay(), getWindow(), 95, 95);
}
@Override
public void openProgress() {
if (progressDialog != null) {
progressDialog.show();
}
}
@Override
public void closeProgress() {
if (progressDialog != null) {
progressDialog.cancel();
progressDialog = null;
}
}
}
나에게 Dialog
예를
public abstract class UtilClass {
public static Dialog getDialog(Context context, String text) {
final Dialog progressDialog = new Dialog(context);
progressDialog.setContentView(R.layout.dialog);
progressDialog.setCanceledOnTouchOutside(false);
final Window window = progressDialog.getWindow();
if (window != null) {
window.setBackgroundDrawableResource(android.R.color.transparent);
}else {
Logger.logError("window == null", new NullPointerException(), context);
}
final TextView msg = (TextView) progressDialog.findViewById(R.id.id_tv_loadingmsg);
msg.setText(text);
return progressDialog;
}
을 그냥 대화를 만들 보여 결국 그것입니다 닫습니다 spesial 아무것도 이해할 수 있듯이 ... 제공 whicth하는 방법이있다
내가받을 이유 이 오류?
내가 뭘 잘못하고 있니?
편집
AsynkTask
public void setCroppedPreviewImage() {
new AsyncTask<Void, Void, byte[]>() {
@Override
protected void onPreExecute() {
super.onPreExecute();
openProgress();
}
@Override
protected byte[] doInBackground(Void... voids) {
final String path = model.getImageFilePath();
final Bitmap croppedBitmap = getCroppedBitmapFromPath(path);
return getByteArrayFromBitmap(croppedBitmap);
}
@Override
protected void onPostExecute(byte[] result) {
super.onPostExecute(result);
closeProgress();
iActivityAcceptNotAccept.setPreviewImage(result);
}
}.execute();
}
Dialog 메서드가 두 번 호출하여 첫 번째 문을 닫을 때이 오류가 발생합니다. – sasikumar
http://stackoverflow.com/questions/12000940/android-activity-has-leaked-window-com-android-internal-policy-impl-phonewindow –
@IntelliJAmiya 그렇습니다.이 답변을 보았지만 나에게는 불가능했습니다. .. 대화 상자를 한 번만 호출했습니다.하지만 어쨌든 확인해야합니다. –