Handler(Handler.Callback) is deprecated
问题 Handler(android.os.Handler.Callback) is deprecated what should I use instead? Handler handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(@NonNull Message message) { switch(message.what) { case READ_MESSAGE: byte[] readBuff = (byte[]) message.obj; String tempMessage = new String(readBuff, 0, message.arg1); readMsg.setText(tempMessage); break; } return true; } }); 回答1: From API level 30, there are 2 constructors are deprecated. Handler() Handler(Handler