Thread logs an incrementing number every 250ms
This commit is contained in:
parent
fb9b1a5125
commit
433e5ac6a8
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -10,5 +10,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
TestThread testThread = new TestThread();
|
||||
testThread.run();
|
||||
}
|
||||
}
|
18
app/src/main/java/com/ploedige/threadtest/TestThread.java
Normal file
18
app/src/main/java/com/ploedige/threadtest/TestThread.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.ploedige.threadtest;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class TestThread extends Thread{
|
||||
public void run() {
|
||||
while (true){
|
||||
for(int i =1; i<=20; i++){
|
||||
Log.v("TestThread", String.valueOf(i));
|
||||
try {
|
||||
this.sleep(250);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user