/** Export the current Recipe list to .json format for use in other applications */
  public void export(MenuItem menuItem) {
    Cache cache = new Cache();
    cache.load(this);
    int res = cache.exportRecipes(this);
    Toast toast;

    if (res == -1) toast = Toast.makeText(this, "Export Failed!", Toast.LENGTH_SHORT);
    else toast = Toast.makeText(this, "Exported to sdcard/Download!", Toast.LENGTH_SHORT);

    toast.show();
    return;
  }
  @Override
  protected void onResume() {
    super.onResume();

    Cache cache = new Cache();
    cache.load(this);

    // Populate Recipe List
    ListView list = (ListView) findViewById(R.id.recipe_list);
    list.setAdapter(new RecipeAdapter(list.getContext(), R.layout.item_recipe, cache.getRecipes()));

    list.setOnItemLongClickListener(
        new OnItemLongClickListener() {

          public boolean onItemLongClick(
              AdapterView<?> arg0, View arg1, final int position, long id) {
            Log.d("Testing", "On Clicked!");
            AlertDialog.Builder builder = new AlertDialog.Builder(ActivityViewRecipeList.this);

            final Cache cache = new Cache();
            cache.load(ActivityViewRecipeList.this);

            final Recipe recipe = cache.getRecipe(id);

            builder.setMessage("Remove " + recipe.getTitle() + "?");
            builder.setPositiveButton(
                "Remove",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {

                    cache.removeRecipe(recipe);

                    cache.save(ActivityViewRecipeList.this);

                    onResume();

                    dialog.dismiss();
                  }
                });
            builder.setNegativeButton(
                "Cancel",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                  }
                });

            builder.create();
            builder.show();

            return true;
          }
        });

    list.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
            Intent intent = new Intent(ActivityViewRecipeList.this, ActivityViewRecipe.class);
            intent.putExtra("RECIPE_ID", id);
            startActivity(intent);
          }
        });
  }