01
02
03
04
05
06
07
08
09
10
11
|
void setStaticActivity() {
activity = this;
}
View saButton = findViewById(R.id.sa_button);
saButton.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
setStaticActivity();
nextActivity();
}
});
|
01
02
03
04
05
06
07
08
09
10
11
|
void
setStaticView() {
view = findViewById(R.id.sv_button);
}
View svButton = findViewById(R.id.sv_button);
svButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
setStaticView();
nextActivity();
}
});
|
01
02
03
04
05
06
07
08
09
10
11
12
13
|
void
createInnerClass() {
class
InnerClass {
}
inner =
new
InnerClass();
}
View icButton = findViewById(R.id.ic_button);
icButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
createInnerClass();
nextActivity();
}
});
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
|
void
startAsyncTask() {
new
AsyncTask<
void
,
void
,=
""
void
=
""
>() {
@Override
protected
Void doInBackground(Void... params) {
while
(
true
);
}
}.execute();
}
super
.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View aicButton = findViewById(R.id.at_button);
aicButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
startAsyncTask();
nextActivity();
}
});
void
,>
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
|
void
createHandler() {
new
Handler() {
@Override
public
void
handleMessage(Message message) {
super
.handleMessage(message);
}
}.postDelayed(
new
Runnable() {
@Override
public
void
run() {
while
(
true
);
}
}, Long.MAX_VALUE >>
1
);
}
View hButton = findViewById(R.id.h_button);
hButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
createHandler();
nextActivity();
}
});
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
|
void
spawnThread() {
new
Thread() {
@Override
public
void
run() {
while
(
true
);
}
}.start();
}
View tButton = findViewById(R.id.t_button);
tButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
spawnThread();
nextActivity();
}
});
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
|
void
scheduleTimer() {
new
Timer().schedule(
new
TimerTask() {
@Override
public
void
run() {
while
(
true
);
}
}, Long.MAX_VALUE >>
1
);
}
View ttButton = findViewById(R.id.tt_button);
ttButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
scheduleTimer();
nextActivity();
}
});
|
01
02
03
04
05
06
07
08
09
10
11
12
13
|
void
registerListener() {
SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ALL);
sensorManager.registerListener(
this
, sensor, SensorManager.SENSOR_DELAY_FASTEST);
}
View smButton = findViewById(R.id.sm_button);
smButton.setOnClickListener(
new
View.OnClickListener() {
@Override
public
void
onClick(View v) {
registerListener();
nextActivity();
}
});
|