Skip to content

Instantly share code, notes, and snippets.

View piotr-muzyka's full-sized avatar

Piotr Muzyka piotr-muzyka

  • Wroclaw, Poland
View GitHub Profile
@udacityandroid
udacityandroid / Code snippet from MainActivity.java
Last active February 6, 2023 14:25
Android for Beginners : Negative Number of Cups of Coffee Extra Challenge Solution
/**
* This method is called when the plus button is clicked.
*/
public void increment(View view) {
if (quantity == 100) {
// Show an error message as a toast
Toast.makeText(this, "You cannot have more than 100 coffees", Toast.LENGTH_SHORT).show();
// Exit this method early because there's nothing left to do
return;
}
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:text="Guest List"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />