/** * 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); } }
@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; } } /**/