Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item.setIcon not work #302

Open
Naguchennai opened this issue Mar 8, 2018 · 0 comments
Open

item.setIcon not work #302

Naguchennai opened this issue Mar 8, 2018 · 0 comments

Comments

@Naguchennai
Copy link

item.setIcon not work any help?

 mSearchView.setOnMenuItemClickListener(new FloatingSearchView.OnMenuItemClickListener() {
        @Override
        public void onActionMenuItemSelected(MenuItem item) {


            if(gridorlist.equals("list")){
                SharedPreferences.Editor editor = getSharedPreferences("GRIDLIST", MODE_PRIVATE).edit();
                editor.putString("gridorlist", "grid");
                editor.apply();

                gridorlist ="grid";
                refreshview();

                if(item.getItemId() == R.id.action_grid) {
                    item.setIcon(ContextCompat.getDrawable(MainActivity.this, R.drawable.ic_grid));
                }

            }else{
                SharedPreferences.Editor editor = getSharedPreferences("GRIDLIST", MODE_PRIVATE).edit();
                editor.putString("gridorlist", "list");
                editor.apply();

                gridorlist ="list";
                refreshview();
                if(item.getItemId() == R.id.action_grid) {
                    item.setIcon(ContextCompat.getDrawable(MainActivity.this, R.drawable.ic_list));
                }
            }

        }
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant