-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathLaughingActivity.java
More file actions
114 lines (104 loc) · 4.25 KB
/
LaughingActivity.java
File metadata and controls
114 lines (104 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package com.fiona.personalcodingproject;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.view.View.OnClickListener;
public class LaughingActivity extends Activity {
// reference to buttons
Button button;
@Override
// store or save information to the button
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// connect to laughing_fullscreen XML file
setContentView(R.layout.laughing_fullscreen);
addListenerOnButton1();
addListenerOnButton2();
addListenerOnButton3();
addListenerOnButton4();
addListenerOnButton5();
addListenerOnButton6();
}
public void addListenerOnButton1() {
final Context context = this;
// connect the button to the Rapunzel Image Button
button = (ImageButton)findViewById(R.id.RapunzelButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect main class to the LaughingActivity class (main class activated after LaughingActivity class)
public void onClick(View v) {
Intent intent = new Intent(context, main.class);
startActivity(intent);
}
});
}
public void addListenerOnButton2() {
final Context context = this;
// connect the button to the LionKing Image Button
button = (ImageButton) findViewById(R.id.LionKingButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect main class to the LaughingActivity class (main class activated after LaughingActivity class)
public void onClick(View v) {
Intent intent = new Intent(context, main.class);
startActivity(intent);
}
});
}
public void addListenerOnButton3() {
final Context context = this;
// connect the button to the Elsa Image Button
button = (ImageButton) findViewById(R.id.ElsaButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect main class to the LaughingActivity class (main class activated after LaughingActivity class)
public void onClick(View v) {
Intent intent = new Intent(context, main.class);
startActivity(intent);
}
});
}
public void addListenerOnButton4() {
final Context context = this;
// connect the button to the Aladdin Image Button
button = (ImageButton) findViewById(R.id.AladdinButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect main class to the LaughingActivity class (main class activated after LaughingActivity class)
public void onClick(View v) {
Intent intent = new Intent(context, main.class);
startActivity(intent);
}
});
}
public void addListenerOnButton5() {
final Context context = this;
// connect the button to the Mulan Image Button
button = (ImageButton) findViewById(R.id.MulanButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect main class to the LaughingActivity class (main class activated after LaughingActivity class)
public void onClick(View v) {
Intent intent = new Intent(context, main.class);
startActivity(intent);
}
});
}
public void addListenerOnButton6() {
final Context context = this;
// connect the button to the Pocahontas Image Button
button = (ImageButton) findViewById(R.id.PocahontasButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect main class to the LaughingActivity class (main class activated after LaughingActivity class)
public void onClick(View v) {
Intent intent = new Intent(context, main.class);
startActivity(intent);
}
});
}
}