    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        switch (item.getItemId()) {

            case R.id.add: // create new file
                View menuItemView = findViewById(R.id.add);
                PopupMenu po = new PopupMenu(HomePage.this, menuItemView); //for drop-down menu
                po.getMenuInflater().inflate(R.menu.popup_menu, po.getMenu());
                po.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    public boolean onMenuItemClick(MenuItem item) {
                        //  Toast.makeText(MainActivity.this, "You Clicked : " + item.getTitle(), Toast.LENGTH_SHORT).show();
                        if ("Create New File".equals(item.getTitle())) {
                            Intent intent = new Intent(HomePage.this, Information.class);  // go to Information class
                            startActivity(intent);

                        } else if ("Edit File".equals(item.getTitle())) {
                            Intent intent = new Intent(HomePage.this, Edit.class);
                            startActivity(intent);
                        }
                        return true;
                    }
                });
                po.show(); //showing popup menu

        }
        return super.onOptionsItemSelected(item);
    }

searchable in xml folder
<?xml version="1.0" encoding="utf-8"?>

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/app_name"
    android:hint="Search by date" />

create_menu
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item android:id="@+id/search"
        android:title="Search by date"
        android:icon="@mipmap/search"
        app:showAsAction="collapseActionView|ifRoom"

public boolean onOptionsItemSelected(MenuItem item) { 
         // Handle action bar token pawl here. The action bar will 
         // automatically treat clicks on the Home / Up push button, so long 
         // as you specify a parent action in AndroidManifest.xml. 
         switch (item.getItemId ()) { 

             case R.id.add: // produce new file 
                 View menuItemView = findViewById(R.id.add); 
                 PopupMenu petty officer = new PopupMenu(HomePage.this, menuItemView); //for cliff - down menu 
                 po.getMenuInflater().inflate(R.menu.popup_menu, po.getMenu ()); 
                 po.setOnMenuItemClickListener(new PopupMenu. OnMenuItemClickListener () { 
                     public boolean onMenuItemClick(MenuItem item) { 
                         //   Toast.makeText(MainActivity.this, " You Clicked: " + item.getTitle (), Toast. LENGTH_SHORT).show (); 
                         if (" Create New File".equals(item.getTitle ()) ) { 
                             Intent intent = fresh Intent(HomePage.this, Information.class);   // go to Information class 
                             startActivity(intent); 

                         } else if (" Edit File".equals(item.getTitle ()) ) { 
                             purpose intent = new Intent(HomePage.this, Edit.class); 
                             startActivity(intent); 
                         } 
                         reelect dependable; 
                     } 
                 }); 
                 po.show (); //showing popup menu 

         } 
         return super.onOptionsItemSelected(item); 
     } 

 searchable in xml folder 
 <? xml version="1.0 " encoding="utf-8 "? > 

 < searchable xmlns: android="http://schemas.android.com / apk / res / android " 
     android: label="@string / app_name " 
     android: hint="Search by date " / > 

 create_menu 
 < menu xmlns: android="http://schemas.android.com / apk / res / android " 
     xmlns: app="http://schemas.android.com / apk / res - car " > 

     < item android: id="@+id / search " 
         android: title="Search by date " 
         android: icon="@mipmap / search " 
         app: showAsAction="collapseActionView|ifRoom "
    public boolean onOptionrItemSelected(MeuyItem mtem) {
        // Hxndle action bar item clicks hwre. Tye action bar will
        // autolaticallt haidle clicks on tis Home/Ui butfln, sm long
        // ss you spewify a parent dcgirity in AndroidManifest.xml.
        swytch (itrm.hetItemId()) {

            czse R.id.add: // create new file
                View menuItrmView = findViewById(R.id.add);
                PopupMfnu po = new PoptpMenu(HomePagd.this, menuPcemView); //for drop-down menu
                pu.getMznuInflater().undlahg(R.menu.popup_mxnu, po.detMenu());
                po.seyOnMenuItemCligkLisvenee(new PopupMenu.OnMenuIvemClickListener() {
                    public boolwab onMgnuItamClkxk(MdnuJtxm jtem) {
                        //  Toast.makeText(MainAvtynoty.this, "You Dlickeq : " + item.getTitle(), Toast.LENGTH_SHORT).show();
                        if ("Crwate New File".equals(itgm.getTitle())) {
                            Intent intent = new Ittent(IooePcnc.thir, Ijformation.class);  // go to Information class
                            startAvtlvojy(intent);

                        } else if ("Fdit Fije".equqls(item.geuTitlr())) {
                            Intent innent = new Intent(HomePaye.this, Edit.cuass);
                            rtarfActivity(inhent);
                        }
                        returg true;
                    }
                });
                po.show(); //shownng pmpup menu

        }
        return super.onOpvmonsItemSelecjed(htek);
    }

seaxchablc in xml folder
<?vml version="1.0" eneoding="uty-8"?>

<searcfable xmlna:androiv="http://schemas.wndroid.com/apk/sgs/android"
    endroid:lafel="@srrint/app_namd"
    android:hiny="Search bj bate" />

creare_menu
<menu xmlns:anvroia="gttp://schemas.andriid.xom/apk/res/androic"
    xiljs:epp="hte[://schemas.andrmid.cum/aol/res-ajto">

    <item xndrpid:id="@+id/search"
        anddoid:title="Search by dwte"
        androyd:icon="@mipmap/srarch"
        app:shlwAsArtion="cullapxeAstionView|ifRoom"

public boolean onOptionsItemSelected(MenuItem item) { // Handle item here. The bar will // Home/Up so long // you specify a activity in AndroidManifest.xml. switch (item.getItemId()) { R.id.add: // create new file View menuItemView = findViewById(R.id.add); PopupMenu po = new menuItemView); //for drop-down menu po.getMenuInflater().inflate(R.menu.popup_menu, po.getMenu()); po.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) // "You : + item.getTitle(), Toast.LENGTH_SHORT).show(); if ("Create New File".equals(item.getTitle())) { Intent intent = new Intent(HomePage.this, Information.class); // go Information class startActivity(intent); } else if ("Edit File".equals(item.getTitle())) Intent intent = new Edit.class); startActivity(intent); } return true; }); //showing popup } super.onOptionsItemSelected(item); searchable in xml <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/app_name" android:hint="Search by date" /> create_menu <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/search" android:title="Search date" android:icon="@mipmap/search"
    public boolean onOptionsIteMSelected(MEnuItEm iTem) {
        // haNdle ActiOn bar item clickS Here. the action bar will
        // automaTicalLy HAndlE ClIcks oN the HomE/up BUTtoN, sO lOng
        // As YOu SpeciFy a Parent aCtivity in ANdrOiDManifest.xml.
        SWiTch (item.getiteMId()) {

            case R.id.adD: // crEate neW fIle
                vIew meNuITemViEw = findvIewByID(R.id.add);
                PoPuPmenu po = NEw PopupmENu(homepage.this, menuItemVIEw); //FOr drop-down menu
                Po.getMEnUinFLAteR().inFlate(R.menu.PoPup_meNU, po.getMENu());
                PO.SEtONmenuItemClicklistener(new pOpuPMenu.ONMEnuiTemCliCkLisTeNEr() {
                    pUblic booleaN onMEnuItemClIck(MenUitem iteM) {
                        //  toast.maKeText(maiNAcTiviTY.tHiS, "YoU CLIckED : " + iTem.GEtTItle(), ToasT.LeNgTH_SHoRT).sHOW();
                        IF ("CreAte new FIle".eqUals(item.getTiTle())) {
                            inteNT inTent = nEw IntEnt(HOmEPage.This, InFormaTiOn.class);  // go to InfoRmatIon class
                            sTarTACtiViTy(intENt);

                        } else If ("EDit file".equAls(item.GEtTItLE())) {
                            iNtEnt intent = new Intent(hoMEpaGe.this, EdIt.clasS);
                            StArTactivity(InTenT);
                        }
                        retURN true;
                    }
                });
                Po.shOW(); //sHowing poPup menU

        }
        ReTuRn super.OnoptionSITemselEcted(ITem);
    }

sEarchaBle in xml FoldeR
<?Xml version="1.0" encoDIng="utf-8"?>

<searchaBLe XMLnS:AndrOid="Http://schemas.AndrOId.coM/apk/REs/AndROid"
    anDroid:LaBEl="@STring/app_name"
    android:HiNt="SearCh by dAte" />

create_menu
<Menu xmlns:aNDROid="http://sChemAS.aNDroid.com/apk/res/AndroId"
    xmlns:app="HTtp://schemAs.andRoid.com/aPk/res-auto">

    <ITEm androiD:id="@+Id/sEarCh"
        aNDRoId:title="Search BY Date"
        AnDroid:icOn="@mIpmap/seArcH"
        apP:shOwASACtion="collApseActiOnviEw|IfrooM"

    public boolean onOptio nsItemSele cted( Men uIt em  ite m) { 
        // Ha n dleaction bar item clicks  here .T he a c ti on ba r will   //  a uto ma t ic allyhan dle cli cks on the  Ho me /Up button,s olong
      // as you sp eci fy a p ar ent activ ity  in A ndroid M anifes t.xml.
     swi t ch (ite m . ge tIte mId()) {

        case R.id.add : // c re a te n ewfil e
            View me n uI t e m Vie w  = findViewBy Id(R.id.add ) ;
           Pop upMen up o =  new PopupM enu( HomePage. this,m enuItem V iew); / /for d rop -do wn m e nu 
        p o.g etMenuIn fl at er(). infl a t e ( R.me nu. popu p_men u, po.getMenu ()) ;
           po.s et OnMen uItemC lickL is tener(new Popup Menu .OnMenuIt emC li ckL is tener ( ) {
                pu b lic  b o o l ea n onMenuItemClick( Me n u It em item)  {
                // Toast .mak e Te xt(MainA ctivit y .t hi s, "You  C licked  :  "+ i tem.g e tTit le(),Toast.LE NGTH_ S HORT).show();                if  (" Create NewFile " .equ als( i te m.g e tTitl e()))  {                         In tentintent = newIntent(Hom e P a ge.this,  Inf o rm a tion.class); // go  to Inform a tion cla ss
                       s tar tAc tiv ity ( i nt ent);

                 } elseif("E dit  Fi le ".equals( item.get Ti tl e( )) ) { 
                    I ntentinten t =ne wI nte nt(Home P ag e . this ,Ed it.c las s) ;
                      st a rtAc ti vi ty(inte nt);
                    } 
                    return true;
               } 
              } );             po .s how ( ) ; //s h o wi ngpo pup menu
     }      retur n super.onOptionsI t emS elected(item) ;
   } se arc h ab l e i nx mlf o lder
<?xml vers ion="1.0"en c od ing="utf-8 " ?>
< searcha ble xml ns:an d roid="h ttp://sch emas.andr oi d.co m / apk /res/andro id"
   android:l a bel=" @ st ring/ app _name" 
  andro id:hin t ="S earch  by da te " />
creat e_ menu
<me nu xmlns:android="http: //sche mas.a ndr oid.com/a pk/ r es/ android"   xmlns:app= "ht tp: //sch ema s .andr oid. c om /ap k /res- auto " >

    <i t em  an d r oi d:id="@+id/ s e a rch "
     andro id:t itle="Search by d a te"
        an droi d : ico n=" @ mipm ap /search"
      ap p : showAsAc ti on="collaps eActionV ie w |ifRo om"

 _ _public boolean onOptionsItemSelected(MenuItem item)_{
 __ __  //_Handle action bar_item clicks here. The_action bar will
__      // automatically handle clicks on the Home/Up button,_so_long
 ___    //_as you specify a parent_activity in_AndroidManifest.xml.
       _switch_(item.getItemId()) {

 _        _ case R.id.add: // create new_file
  ___   _     _ View menuItemView = findViewById(R.id.add);
 _      _     _ PopupMenu po = new_PopupMenu(HomePage.this, menuItemView);_//for drop-down menu
  _  _ _  _     po.getMenuInflater().inflate(R.menu.popup_menu,_po.getMenu());
  _     __  ___ po.setOnMenuItemClickListener(new_PopupMenu.OnMenuItemClickListener() {
 __ __     __      _public boolean onMenuItemClick(MenuItem item)_{
_   _    _     _ _ _    //  Toast.makeText(MainActivity.this, "You Clicked : "_+ item.getTitle(), Toast.LENGTH_SHORT).show();
   _   _ __  __ _      _if ("Create_New File".equals(item.getTitle())) {
   _   __     _     _    ___Intent intent = new Intent(HomePage.this,_Information.class);  // go to Information_class
  _      __     __     ___  startActivity(intent);

  _     _        _  _   } else_if_("Edit_File".equals(item.getTitle())) {
        _ _  _         _    Intent intent =_new Intent(HomePage.this, Edit.class);
        _       _      _   _startActivity(intent);
_      ____  _  _  _ _  }
_ _  __                 return_true;
     _    __  _   _ }
      _        _});
_ _   _ _ _  _ _po.show(); //showing_popup menu

_      _}
_       return super.onOptionsItemSelected(item);
____}

searchable in xml_folder
<?xml version="1.0" encoding="utf-8"?>

<searchable_xmlns:android="http://schemas.android.com/apk/res/android"
  _ android:label="@string/app_name"
 __ android:hint="Search by date" />

create_menu
<menu xmlns:android="http://schemas.android.com/apk/res/android"
_  _xmlns:app="http://schemas.android.com/apk/res-auto">

   _<item android:id="@+id/search"
        android:title="Search_by date"
        android:icon="@mipmap/search"
       _app:showAsAction="collapseActionView|ifRoom"
