Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created May 25, 2017 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jezinka/61762239e9e1285acccd1a16b8645575 to your computer and use it in GitHub Desktop.
Save jezinka/61762239e9e1285acccd1a16b8645575 to your computer and use it in GitHub Desktop.
private void showAddRecipeDialog(final Meal meal) {
View view = getLayoutInflater().inflate(R.layout.multiline_dialog, null);
final EditText recipeText = (EditText) view.findViewById(R.id.multiline_edit_text);
recipeText.setText(meal.getRecipe());
new AlertDialog.Builder(this)
.setTitle(R.string.recipe)
.setView(view)
.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mealContract.addRecipe(dbHelper, recipeText.getText().toString(), meal.getId());
adapter.updateResults(mealContract.getAllMealsArray(dbHelper));
}
})
.setNegativeButton(R.string.cancel, null)
.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment