Loading app/src/main/java/com/example/toast/MainActivity.javadeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line package com.example.toast; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends AppCompatActivity { String[] toasts = {"Wanna hear a joke?", "It's quiz time! Let's meet at PHO.", "You guys look tired, let's take a break."}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onStart() { super.onStart(); int ii = 0; while (true) { try { Thread.sleep(5000); Toast.makeText(this,toasts[ii],Toast.LENGTH_SHORT).show(); if (ii<2) { ii++; } else { ii = 0; } } catch (InterruptedException e) { throw new RuntimeException(e); } } } } No newline at end of file Loading
app/src/main/java/com/example/toast/MainActivity.javadeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line package com.example.toast; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends AppCompatActivity { String[] toasts = {"Wanna hear a joke?", "It's quiz time! Let's meet at PHO.", "You guys look tired, let's take a break."}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onStart() { super.onStart(); int ii = 0; while (true) { try { Thread.sleep(5000); Toast.makeText(this,toasts[ii],Toast.LENGTH_SHORT).show(); if (ii<2) { ii++; } else { ii = 0; } } catch (InterruptedException e) { throw new RuntimeException(e); } } } } No newline at end of file