Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I dismiss listpopupwindow on item selected instead of picking outside the popup

I have android listpopupwindow installed and working in my android app.

I wish to dismiss the popuplist when I click on (and choose) an item instead of clicking outside.

I tried the dismiss(), and dismiss(); break; method anywhere....

I just want to chose an item in the list and after that the popup to go away...

Thanks, Lou

like image 615
Lou Avatar asked Nov 04 '22 08:11

Lou


1 Answers

This code worked for me:

popupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                popupWindow.dismiss();
            }
        });
like image 193
klemzy Avatar answered Jan 04 '23 13:01

klemzy