相关疑难解决方法(0)

如何在android firebase聊天中显示输入指示符

我需要使用firebase在聊天应用程序中实现打字指示器.我有一个逻辑

  • 添加textwatcher侦听器,并在firebase db中名为键入的字段的文本更改侦听器更新标志中
  • 然后我认为当值更改时,它将通知值更改侦听器

    如果任何人有代码实现请分享.

在此输入图像描述

android android-edittext firebase firebase-realtime-database

8
推荐指数
1
解决办法
966
查看次数

如何确定是否有人在editText上键入

我正在使用android studio设计聊天应用程序,并且使用fire-base作为云服务提供商,并且我掌握了如何使监听程序(如用户在编辑文本字段中键入内容)的库存。 base将变为true,并且当用户不键入时,该值将变为false。我正在寻找此解决方案大约一个星期,但没有找到关于我的研究的任何答案。

如何放置TextWatcher?

编辑

       final Firebase firebase = new Firebase("https://my-first-sample-is.firebaseio.com/");


            editText = (EditText) findViewById(R.id.editText);

            listView = (ListView) findViewById(R.id.listView);

            listView.setAdapter(new MessageAdapter(this, Message.class, R.layout.fragment_message, firebase.child("chat")));
            editText.setAdapter(new RoomTypeAdapter(this, RoomType.class, R.layout.fragment_message1, firebase.child("Room-Typing")));

            button = (Button) findViewById(R.id.button);



            button.setOnClickListener(new View.OnClickListener() {


                @Override
                public void onClick(View view) {
  Message message = new Message();

                message.setMessage(editText.getText().toString());
                editText.setText("");
                message.setAuthor("Name");
                message.setNumMessages(numMessages);


                firebase.child("chat").push().setValue(message);


            }
        });
        editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
        editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {

                    return true;
                }
                return false;
            }
        }); …
Run Code Online (Sandbox Code Playgroud)

java android textwatcher

-2
推荐指数
1
解决办法
2170
查看次数