greenfablab

GreenFabLab Android App
Log | Files | Refs

MainActivity.java (1449B)


      1 package space.nocebo.myapplication;
      2 
      3 import androidx.appcompat.app.AppCompatActivity;
      4 
      5 import android.content.Intent;
      6 import android.os.Bundle;
      7 import android.os.Handler;
      8 import android.view.View;
      9 import android.widget.Button;
     10 import android.widget.ImageButton;
     11 import android.widget.Toast;
     12 
     13 public class MainActivity extends AppCompatActivity {
     14 
     15     @Override
     16     protected void onCreate(Bundle savedInstanceState) {
     17         super.onCreate(savedInstanceState);
     18         setContentView(R.layout.activity_main);
     19         ImageButton button1 = (ImageButton) findViewById(R.id.imageButton2);
     20         button1.setOnClickListener(new View.OnClickListener() {
     21             public void onClick(View v) {
     22                 String s = "English selected";
     23                 Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
     24             }
     25         });
     26 
     27         ImageButton button2 = (ImageButton) findViewById(R.id.imageButton3);
     28         button2.setOnClickListener(new View.OnClickListener() {
     29             public void onClick(View v) {
     30                 String s = "Deutsch selected";
     31                 Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
     32             }
     33         });
     34 
     35         new Handler().postDelayed(new Runnable() {
     36             @Override
     37             public void run() {
     38                 Intent intent = new Intent(MainActivity.this, Dashboard.class);
     39                 startActivity(intent);
     40             }
     41         },5000);
     42     }
     43 }