Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created May 25, 2017
Embed
What would you like to do?
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