Android Handler Thread HandlerThread
Handler.Callback callback = new Handler.Callback()
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = findViewById(R.id.textView);
button = findViewById(R.id.button);
CC();
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
handler.sendEmptyMessage(99);
}
});
}
protected void CC() {
HandlerThread handlerThread = new HandlerThread("test");
handlerThread.start();
Handler.Callback callback = new Handler.Callback() {
@Override
public boolean handleMessage(Message message) {
System.out.println();
System.out.println(Thread.currentThread().getName());
System.out.println("0000000000000000000000000000000000000");
return false;
}
};
handler = new Handler(handlerThread.getLooper(), callback);
}
0 件のコメント:
コメントを投稿