-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
해결됨
쓰레드가 작동을 안합니다. 로그D도 안뜹니다 다른로그는뜨는데..
20.01.11 19:39 작성 조회수 134
0
쓰레드가 작동을 안합니다. 로그d도 안뜹니다
다른로그는 뜨는데..필터를 바꿔봐도 안뜹니다.
왜 그런지 잘 모르겠어요.
설정을 바꿔야 하는 부분이 있을까요?
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView text,text1;
boolean Running = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView)findViewById(R.id.text);
text1 = (TextView)findViewById(R.id.text1);
Running = true;
Thread thread = new Thread();
thread.start();
}
public void bu(View v){
// while(true) {
// SystemClock.sleep(100);
// long now = System.currentTimeMillis();
// text.setText("현재시간은 : " + now);
// }
}
class thread extends Thread{
@Override
public void run(){
while(Running){
SystemClock.sleep(100);
long now = System.currentTimeMillis();
text1.setText("쓰레드"+now);
Log.d("while","현시간은 : "+now);
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
Running = false;
}
}
답변을 작성해보세요.
0
0
답변 2