@Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); Log.v(MainActivity.LOGGING_KEY, this.getClass().getName() + " onActivityCreate invoke"); ArrayList<String> titles = new ArrayList<String>(); for (Recipe x : recipes) { titles.add(x.getRecipeName()); } adapter = new RecipeArrayAdapter(getActivity(), recipes); setListAdapter(adapter); Log.v(MainActivity.LOGGING_KEY, this.getClass().getName() + " onActivity end"); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub Log.v("search", this.getClass().getName() + " onActivityResult invoked"); if (resultCode == MainActivity.RESULT_OK && requestCode == MainActivity.RECIPE_REQUEST_CODE) { Log.v("search", "onActivity condition"); if (data.hasExtra(MainActivity.EXTRA_RECIPE)) { recipe = (Recipe) data.getSerializableExtra(MainActivity.EXTRA_RECIPE); // for(ProcIngredient i:recipe.getIngredients()){ // if(i.isCheck()){ // Log.v("search", "true"); // } // else{ // Log.v("search", "false"); // } // } for (int i = 0; i < recipes.size(); i++) { if (recipe.getRecipeName().equals(recipes.get(i).getRecipeName())) { Log.v("search", "yesss"); recipes.remove(i); recipes.add(i, recipe); break; } } adapter.notifyDataSetChanged(); } } Log.v("search", this.getClass().getName() + " onActivityResult end"); }