app/src/main/java/fr/free/nrw/commons/category/CategoryDetailsActivity.java
@Override
    public boolean onOptionsItemSelected(MenuItem item) {

        // Handle item selection
        switch (item.getItemId()) {
            case R.id.menu_browser_current_category:
                Intent viewIntent = new Intent();
                viewIntent.setAction(Intent.ACTION_VIEW);
                viewIntent.setData(new PageTitle(categoryName).getCanonicalUri());
                //check if web browser available
                if (viewIntent.resolveActivity(this.getPackageManager()) != null) {
                    startActivity(viewIntent);
                } else {
                    Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
                    toast.show();
                }
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
/**
     * This method handles the logic on ItemSelect in toolbar menu
     * Currently only 1 choice is available to open category details page in browser
     */
This method handles the logic on ItemSelect in toolbar menu
Currently only 1 choice is available to open category details page in browser
This method handles the logic on ItemSelect in toolbar menu Currently only 1 choice is available to open category details page in browser
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_browser_current_category:
                Intent viewIntent = new Intent();
                viewIntent.setAction(Intent.ACTION_VIEW);
                viewIntent.setData(new PageTitle(categoryName).getCanonicalUri());
                if (viewIntent.resolveActivity(this.getPackageManager()) != null) {
                    startActivity(viewIntent);
                } else {
                    Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
                    toast.show();
                }
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
@ Override public boolean onOptionsItemSelected ( MenuItem item ) { switch ( item . getItemId ( ) ) { case R . id . menu_browser_current_category : Intent viewIntent = new Intent ( ) ; viewIntent . setAction ( Intent . ACTION_VIEW ) ; viewIntent . setData ( new PageTitle ( categoryName ) . getCanonicalUri ( ) ) ; if ( viewIntent . resolveActivity ( this . getPackageManager ( ) ) != null ) { startActivity ( viewIntent ) ; } else { Toast toast = Toast . makeText ( this , getString ( R . string . no_web_browser ) , LENGTH_SHORT ) ; toast . show ( ) ; } return true ; default : return super . onOptionsItemSelected ( item ) ; } }
This method handles the logic on ItemSelect in toolbar menu
 Currently only 1 choice is available to open category details page in browser
This method handles the logic on ItemSelect in toolbar menu Currently only 1 choice is available to open category details page in browser
// Handle item selection //check if web browser available