Skip to content Skip to sidebar Skip to footer

Can't Edit An Edittext In A Popup Window Without Dismissing And Recalling It First

I am using a popup window to display some information and have an edit button that allows that information to be changed. I am loading all textviews, buttons and edittext fields a

Solution 1:

I have implemented a solution, though it may not be the best solution. I have set a boolean field at the class initialization that checks if the popupwindow has ever been called. If it has not yet been called, then it will immediately dismiss the popupwindow and re-open it since my problem is in the popupwindow initialization.

    pwInfo.showAtLocation(llInfo, Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0);
    pwInfo.update(0, 0, llMain.getWidth()-50, llMain.getHeight()-100);
    pwInfo.setFocusable(true);

    if (pwFirst) {
        pwFirst = false;
        pwInfo.dismiss();
        pwInfo.showAtLocation(llInfo, Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0);
        pwInfo.update(0, 0, llMain.getWidth()-50, llMain.getHeight()-100);
        pwInfo.setFocusable(true);
    }

Not the best solution, but it works.

Solution 2:

Try this,

finalPopupWindowpopupWindow=newPopupWindow(popupView,LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,true);

works for me.

Solution 3:

Solution 4:

Whenever you create a PopupWindow you must put true in focusable like that :

 PopupWindow(View contentView, int width, int height, boolean focusable) 

  finalPopupWindowpopupWindow=newPopupWindow(popupView,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,true); 

good luck

Post a Comment for "Can't Edit An Edittext In A Popup Window Without Dismissing And Recalling It First"