Loading MainActivity.java 0 → 100644 +31 −0 Original line number Diff line number Diff line package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import java.util.Timer; import java.util.TimerTask; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "I brought the wrong toast to the wedding, at least the ducks enjoyed it", Toast.LENGTH_SHORT).show(); } }); } }, 0, 7500); //makes it so that it takes 5 seconds after each message disappears to show the next one. } } No newline at end of file Loading
MainActivity.java 0 → 100644 +31 −0 Original line number Diff line number Diff line package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import java.util.Timer; import java.util.TimerTask; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "I brought the wrong toast to the wedding, at least the ducks enjoyed it", Toast.LENGTH_SHORT).show(); } }); } }, 0, 7500); //makes it so that it takes 5 seconds after each message disappears to show the next one. } } No newline at end of file