blob: 2d6196b79187de1b97af5dbd10b44cef880cde11 (
plain)
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
|
package com.example.simpleperf.simpleperfexamplepurejava;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
createBusyThread();
}
void createBusyThread() {
new Thread(new Runnable() {
volatile int i = 0;
@Override
public void run() {
while (true) {
i = callFunction(i);
}
}
private int callFunction(int a) {
return a+1;
}
}, "BusyThread").start();
}
}
|