I have a small problem with the popup window functionality.I would like to close it when the user clicks outside of the window.I have read a lots of atricle on stackoverflow, but not a single articles helped me. What I have tried is, I have tried to popupwindow.setBackgroundDrawable(null); which is not worked for me.
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.popupmenu_layout, (ViewGroup) findViewById(R.id.popuplinearlayout));
pw = new PopupWindow(layout, 300, 300, true);
pw.showAtLocation(layout, Gravity.CENTER, 0, 0);
pw.setBackgroundDrawable(null);
pw.setOutsideTouchable(true);
//Todo remove popup window when outside is touched...
If you know a good article what may help me I would appreciate it.It is posible this features is not working in emulator ? I have only emulator right now.(android 4.4.2)