/**
  * This method retrieves the Library of videos from the task and passes them to our ListView
  *
  * @param msg
  */
 private void populateListWithItems(Message msg) {
   // Retreive the videos are task found from the data bundle sent back
   ItemLibrary lib = (ItemLibrary) msg.getData().get(GetItemsTask.LIBRARY);
   // Because we have created a custom ListView we don't have to worry about setting the adapter in
   // the activity
   // we can just call our custom method with the list of items we want to display
   ProgressBar pbpp = (ProgressBar) getView().findViewById(R.id.pbppl);
   TextView txtMsg = (TextView) getView().findViewById(R.id.progressMsg2);
   listView.setItems(lib.getItems());
   if (lib.getItems().isEmpty()) {
     txtMsg.setText("No Items for today, take a break");
     pbpp.setVisibility(View.GONE);
   } else {
     pbpp.setVisibility(View.GONE);
     txtMsg.setVisibility(View.GONE);
     items = lib.getItems();
     listView.setItems(items);
   }
 }
  // ListFragment is a very useful class that provides a simple ListView inside of a Fragment.
  // This class is meant to be sub-classed and allows you to quickly build up list interfaces
  // in your app.
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d("FragmentCycle===>", "onCreateView: bundle=" + parseNull(savedInstanceState));
    View view = inflater.inflate(R.layout.list_items, container, false);

    Calendar c = Calendar.getInstance();
    SimpleDateFormat currentDate2 = new SimpleDateFormat("MMM/dd");
    String currentDate = currentDate2.format(c.getTime());
    String Day_id = String.valueOf(today - 1);
    Intent in = getActivity().getIntent();
    String dyT = null;

    // this.dayId = today+"";
    dayId = String.valueOf(today - 1);
    dayTitle = daysOfWeek[today];
    dyT = dayTitle + ", " + currentDate;

    TextView txtDateToday = (TextView) view.findViewById(R.id.txtDateToday);
    txtDateToday.setText(dyT);

    // create a listview to hold data
    listView = (ItemsListView) view.findViewById(R.id.todayListView);

    // Here we are adding this activity as a listener for when any row in the List is 'clicked'
    // The activity will be sent back the video that has been pressed to do whatever it wants with
    // in this case we will retrieve the URL of the video and fire off an intent to view it
    listView.setOnItemClickListener(this);
    listView.setOnItemLongClickListener(this);

    getItemsFeed(listView);

    registerForContextMenu(listView);

    return view;
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);
    // check if the request code is same as what is passed  here it is 2
    if (resultCode == Activity.RESULT_OK) {

      int editPos = Integer.parseInt(data.getStringExtra("position_D"));
      String item_price = data.getStringExtra("price");
      String status_image_url = data.getStringExtra("status_uri_image");
      String itemimage_url = data.getStringExtra("itemimage_url");
      String itemtime = data.getStringExtra("delivery_date");
      String item_name = data.getStringExtra("item_name");
      String client_name = data.getStringExtra("client_name");
      String location = data.getStringExtra("location");
      String phoneno = data.getStringExtra("phoneno");
      String product_id = data.getStringExtra("product_id");
      int order_id = Integer.parseInt(data.getStringExtra("order_id"));
      items.set(
          editPos,
          new Item(
              order_id,
              product_id,
              client_name,
              phoneno,
              item_name,
              item_price,
              itemtime,
              location,
              itemimage_url,
              status_image_url));

      listView.setItems(items);
      // ItemAdapter.notifyDataSetChanged();
    }
    if (resultCode == Activity.RESULT_CANCELED) {
      return;
    }
  } /**/