Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Created October 12, 2023 20:23
Show Gist options
  • Save topherPedersen/637042c0e41f6e0195374cd16f57de58 to your computer and use it in GitHub Desktop.
Save topherPedersen/637042c0e41f6e0195374cd16f57de58 to your computer and use it in GitHub Desktop.
Display a Toast Message on Android (using Java)
package com.example.toastapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(getApplicationContext(), "foo", Toast.LENGTH_LONG);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment