Hello. Such a problem. There is an ArrayList () in which the current text messages are stored. The list displays the adapter.
Question: How to add data to ArrayList by clicking on a button?
@Override public void response(ArrayList<ResponseMsgArray> response) { // тут мои текущие данные int count = response.size() - 1; if(count > 0) { getEndMsgId = response.get(count).getNewMsg(); } if(sAdapter == null) { sAdapter = new ChatMsgAdapter(this, response); listView.setAdapter(sAdapter); Log.d(LOG_TAG, "Array:: setAdapter" + getEndMsgId); } else { sAdapter.setData(response); Log.d(LOG_TAG, "Array:: setData" + getEndMsgId); } } public void sendMsg(View v) { //кнопка editText = (EditText) findViewById(R.id.form_input); String form_input_msg = editText.getText().toString(); if (!form_input_msg.equals("")) { GetMsg getMsg = new GetMsg(); getMsg.SendMsg(getApplicationContext(), GET_ID, form_input_msg); } }