How to process the ListView cell click



  • There is a ListView consisting of 2 EditText. The pressure on the ListView element should be processed.

    введите сюда описание изображения

    I used to do it through an event onClick at EditText:

    // Метод, обрабатывающий клик на один из EditText'ов
    public void onClickDbResource(View view) {
        EditText etResource = (EditText) findViewById(R.id.tvResource);
    
    String resourceInEdit = edittextResource.getText().toString();
    // Метод для дропа в Clipbrd
    CopyToClipboard(resourceInView);
    

    }

    The method worked, but it didn't matter to match the chosen item.



  • Isn't it clear that we need to process the ListView or EditText in ListView?

    ListView:

    listView.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {
            // Logics
          }
    });
    

    UPD:

    • parent - View parent for compressed paragraph
    • view is a pressing point.
    • position = item number on the list
    • id - component identifier

    UPD2:

    In your case, you'll need a castomized list with your adapter.

    • http://www.vogella.com/tutorials/AndroidListView/article.html
    • http://startandroid.ru/ru/uroki/vse-uroki-spiskom/113-urok-54-kastomizatsija-spiska-sozdaem-svoj-adapter.html
    • https://ru.stackoverflow.com/questions/215556/%D0%9A%D0%B0%D0%BA-%D0%B2-listview-%D0%BE%D0%B1%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0%D1%82%D1%8C-%D0%BD%D0%B0%D0%B6%D0%B0%D1%82%D0%B8%D0%B5-%D0%BA%D0%BD%D0%BE%D0%BF%D0%BA%D0%B8-%D0%B8-%D0%B8%D0%B7%D0%BC%D0%B5%D0%BD%D0%B8%D1%82%D1%8C-%D0%B7%D0%B4%D0%B5%D1%81%D1%8C-%D0%B6%D0%B5-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5-%D0%B2-textview



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2