Advertisement
KillianMills

MainActivity.java

Mar 13th, 2015
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.47 KB | None | 0 0
  1. package killianmills.pycast;
  2.  
  3. import android.app.Activity;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.os.Bundle;
  7. import android.widget.Button;
  8. import android.view.View;
  9. import android.view.View.OnClickListener;
  10.  
  11. public class MainActivity extends Activity {
  12.  
  13.     Button connect;
  14.  
  15.     @Override
  16.     public void onCreate(Bundle savedInstanceState) {
  17.         super.onCreate(savedInstanceState);
  18.         setContentView(R.layout.activity_main);
  19.         //For 4 buttons on main menu
  20.         addListenerOnButton1();
  21.         addListenerOnButton2();
  22.         addListenerOnButton3();
  23.         addListenerOnButton4();
  24.     }
  25.  
  26.     // CONNECTION SETTINGS
  27.     public void addListenerOnButton1() {
  28.  
  29.         final Context context = this;
  30.  
  31.         connect = (Button) findViewById(R.id.connectionButton);
  32.  
  33.         connect.setOnClickListener(new OnClickListener() {
  34.  
  35.             @Override
  36.             public void onClick(View arg0) {
  37.  
  38.                 Intent intent = new Intent(context, ConnectionSettings.class);
  39.                 startActivity(intent);
  40.  
  41.             }
  42.  
  43.         });
  44.  
  45.     }
  46.  
  47.     // GENERAL MODE
  48.     public void addListenerOnButton2() {
  49.  
  50.         final Context context = this;
  51.  
  52.         connect = (Button) findViewById(R.id.generalButton);
  53.  
  54.         connect.setOnClickListener(new OnClickListener() {
  55.  
  56.             @Override
  57.             public void onClick(View arg0) {
  58.  
  59.                 Intent intent = new Intent(context, GeneralMode.class);
  60.                 startActivity(intent);
  61.  
  62.             }
  63.  
  64.         });
  65.  
  66.     }
  67.  
  68.     // PRESENTATION MODE
  69.     public void addListenerOnButton3() {
  70.  
  71.         final Context context = this;
  72.  
  73.         connect = (Button) findViewById(R.id.presentationButton);
  74.  
  75.         connect.setOnClickListener(new OnClickListener() {
  76.  
  77.             @Override
  78.             public void onClick(View arg0) {
  79.  
  80.                 Intent intent = new Intent(context, PresentationMode.class);
  81.                 startActivity(intent);
  82.  
  83.             }
  84.  
  85.         });
  86.  
  87.     }
  88.  
  89.     // ABOUT
  90.     public void addListenerOnButton4() {
  91.  
  92.         final Context context = this;
  93.  
  94.         connect = (Button) findViewById(R.id.aboutButton);
  95.  
  96.         connect.setOnClickListener(new OnClickListener() {
  97.  
  98.             @Override
  99.             public void onClick(View arg0) {
  100.  
  101.                 Intent intent = new Intent(context, About.class);
  102.                 startActivity(intent);
  103.  
  104.             }
  105.  
  106.         });
  107.  
  108.     }
  109.  
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement