Thread logs an incrementing number every 250ms

This commit is contained in:
Paul 2020-11-09 09:34:08 +01:00
parent fb9b1a5125
commit 433e5ac6a8
3 changed files with 27 additions and 0 deletions

6
.idea/vcs.xml generated Normal file
View 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>

View File

@ -10,5 +10,8 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
TestThread testThread = new TestThread();
testThread.run();
} }
} }

View 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();
}
}
}
}
}