void updatePintrestView() {
    LayoutInflater inflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // inflate your activity layout here!

    sortingArray();
    Layout1.removeAllViews();
    Layout2.removeAllViews();

    for (int i = 0; i < arrDataNote.size(); i++) {

      View contentView = inflater.inflate(R.layout.notefoldepintrestrow, null, false);

      TextView textViewSlideMenuName =
          (TextView) contentView.findViewById(R.id.textViewSlideMenuName);
      TextView textViewSlideMenuNameSubTitle =
          (TextView) contentView.findViewById(R.id.textViewSlideMenuNameSubTitle);
      View layoutsepreter = (View) contentView.findViewById(R.id.layoutsepreter);
      layoutsepreter.setVisibility(View.VISIBLE);

      SideMenuitems model = arrDataNote.get(i);
      textViewSlideMenuName.setText(model.getMenuName());
      textViewSlideMenuNameSubTitle.setText(model.getMenuNameDetail());

      if (i % 2 == 0) {
        Layout1.addView(contentView);
        contentView.setBackgroundColor(Color.parseColor(model.getColours()));
      } else {
        Layout2.addView(contentView);
        contentView.setBackgroundColor(Color.parseColor(model.getColours()));
      }
    }
  }
  public void didlistItemClick(SideMenuitems item1, View selectedbutton, int selectedindex) {
    Log.d("The listitem : ", "ID: " + item1.getMenuid() + "\n");
    Log.d("The listitem: ", "Text: " + selectedbutton.getTag() + "\n");
    Log.d("The listitem: ", "Index: " + selectedindex + "\n");

    SideMenuitems menuItem = arrDataNote.get(selectedindex);

    if (menuItem.isIsdefaultNote() != true) {
      DBNoteItems noteItems = arrDBDataNote.get(selectedindex);

      DataManager.sharedDataManager().setSeletedListNoteItem(menuItem);
      DataManager.sharedDataManager().setSeletedDBNoteItem(noteItems);
      startActivity(new Intent(context, NoteMainActivity.class));
    } else {
      Toast.makeText(
              FolderNoteListMainActivity.this, "Default Note can't be open", Toast.LENGTH_SHORT)
          .show();
    }
  }
  void getNoteWithTitle(String note_title) {
    ArrayList<DBNoteItems> arrinsertedNote =
        androidOpenDbHelperObj.getAllNotesWithTitle(note_title);

    for (DBNoteItems dbNoteItems : arrinsertedNote) {
      System.out.println(
          "note id: " + dbNoteItems.getNote_Id() + " note_title: " + dbNoteItems.getNote_Title());

      SideMenuitems item1 = new SideMenuitems();
      item1.setMenuName(dbNoteItems.getNote_Title());
      item1.setMenuNameDetail("");
      item1.setMenuid(dbNoteItems.getNote_Id());
      item1.setColours("#" + dbNoteItems.getNote_Color());

      arrDataNote.add(item1);
      arrDBDataNote.add(dbNoteItems);
    }
    adapter.notifyDataSetChanged();
  }
  public void didMoreSelected(SideMenuitems item1, View selectedbutton, int selectedindex) {

    selectedDbItem = arrDBDataNote.get(selectedindex);

    Log.d("The TextChange: ", "ID: " + item1.getMenuid() + "\n");
    Log.d("The TextChange: ", "Text: " + selectedbutton.getTag() + "\n");
    Log.d("The TextChange: ", "Index: " + selectedindex + "\n");

    // androidOpenDbHelperObj.updateNoteElementText(notelistData.getNoteElmentId(), text);
    // NoteListDataModel editedDatamodel=arrNoteListData.get(position);
    // editedDatamodel.setStringtext(text);

    PopupMenu popup = new PopupMenu(FolderNoteListMainActivity.this, selectedbutton);

    popup.getMenuInflater().inflate(R.menu.poupup_menu, popup.getMenu());
    popup.setOnMenuItemClickListener(
        new PopupMenu.OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {

            Toast.makeText(
                    FolderNoteListMainActivity.this,
                    "You Clicked : " + item.getTitle(),
                    Toast.LENGTH_SHORT)
                .show();

            switch (item.getItemId()) {
              case R.id.EditTitle:
                {
                  showAlertWithUpdateTitleEditText(
                      FolderNoteListMainActivity.this,
                      selectedDbItem,
                      selectedDbItem.getNote_Title());
                }
                break;
              case R.id.Delete:
                {
                  showAlertWithDeleteMessage(
                      "Are you sure you want delete this note",
                      FolderNoteListMainActivity.this,
                      selectedDbItem);
                }
                break;
              case R.id.timebomb:
                {

                  /*	SimpleDateFormat dateFormatGmt = new SimpleDateFormat(
                  		"dd/MM/yyyy HH:mm:ss");
                  dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT"));
                  Date d = new Date();
                  String strDate = dateFormatGmt.format(d);
                  selectedDbItem.setNote_TimeBomb(strDate);

                  boolean status=androidOpenDbHelperObj.updateNoteitems_timeBomb(selectedDbItem);

                  if (status==true)
                  {

                  	Toast.makeText(MainActivity.this,"Time Bomb added successfully",Toast.LENGTH_SHORT).show();
                  	getallNotes();
                  }
                  else
                  {
                  	Toast.makeText(MainActivity.this,"Time Bomb added unsuccessfully",Toast.LENGTH_SHORT).show();

                  }*/

                }
                break;
              case R.id.Lock:
                {
                }
                break;
              case R.id.Share:
                {
                }
                break;

              case R.id.Move:
                {
                  if (arrDataFolder != null) {

                    if (arrDataFolder.size() > 0) {
                      showMoveToFolderDialog("", FolderNoteListMainActivity.this, selectedDbItem);
                    } else {
                      showAlertWith(
                          "Please create at least one folder", FolderNoteListMainActivity.this);
                    }
                  }
                }
                break;

              case R.id.Color:
                {

                  /*ColorPickerDialog colorPickerDialog = new ColorPickerDialog(MainActivity.this,Color.WHITE,new  ColorPickerDialog.OnColorChangedListener()
                  {


                  	public void onColorSelected(int color) {
                  		// do action
                  	}



                  });
                  colorPickerDialog.show();*/

                  new ColorPickerDialog(
                          FolderNoteListMainActivity.this,
                          new ColorPickerDialog.OnColorChangedListener() {
                            @Override
                            public void colorChanged(int color) {

                              Log.d("selected Color", "" + color);
                            }
                          },
                          Color.WHITE)
                      .show();
                }
                break;
              default:
                break;
            }
            return true;
          }
        });

    popup.show(); // showing popup menu
  }
  /** *********** Fetch all note from database ***************** */
  void getallNotes() {
    arrDataNote.clear();
    arrDBDataNote.clear();

    ArrayList<DBNoteItems> arrinsertedNote =
        androidOpenDbHelperObj.getAllNotesWithFolder_Id(
            DataManager.sharedDataManager().getSelectedFolderId());

    for (DBNoteItems dbNoteItems : arrinsertedNote) {
      System.out.println(
          "note id: " + dbNoteItems.getNote_Id() + " note_title: " + dbNoteItems.getNote_Title());

      SideMenuitems item1 = new SideMenuitems();
      item1.setMenuName(dbNoteItems.getNote_Title());
      ArrayList<DBNoteItemElement> dbNoteItemElements =
          androidOpenDbHelperObj.getLastNotesElementWithNote_Id(dbNoteItems.getNote_Id());
      item1.setMenuNameDetail(
          ""
              + (dbNoteItemElements.size() > 0
                  ? dbNoteItemElements.get(0).getNOTE_ELEMENT_TYPE()
                  : ""));
      item1.setMenuid(dbNoteItems.getNote_Id());
      if (dbNoteItems.getNote_Color().length() > 0 && dbNoteItems.getNote_Color() != null) {

        item1.setColours("#" + dbNoteItems.getNote_Color());
      }

      arrDataNote.add(item1);
      arrDBDataNote.add(dbNoteItems);

      if (item1.getTimeBomb() != null) {

        if (!item1.getTimeBomb().equalsIgnoreCase("0")) {
          SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
          formatter.setTimeZone(TimeZone.getTimeZone("GMT"));

          Date currentdate = new Date();
          String strDate = formatter.format(currentdate);

          try {

            Date timebombdate = formatter.parse(item1.getTimeBomb().toString());

            Date dateCurrent = formatter.parse(strDate);

            System.out.println(timebombdate);
            System.out.println(formatter.format(timebombdate));

            if (dateCurrent.compareTo(timebombdate) > 0) {
              System.out.println("Date1 is after Date2 --Delete note here");
            } else if (dateCurrent.compareTo(timebombdate) < 0) {
              System.out.println("Date1 is before Date2");
            } else if (dateCurrent.compareTo(timebombdate) == 0) {
              System.out.println("Date1 is equal to Date2");
            }

          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      }
    }
    adapter.notifyDataSetChanged();
  }