Skip to content

I want just find solution this. onclickData problem. - read one single cell value. If you can tell tips #204

Description

@Hessu007

I new with the TableView component. Is there some one who can show me, how to read. one single Cell value.
If i am understand right public void onDataClicked - just return RowIndex int value - that fine - but not columnIndex. Or is there something like getSelectedCellValue() function or... how to implement

@OverRide
public void onDataClicked(int rowIndex, String[] strings) {

        final String carString = "Click: " + rowIndex;
        Toast.makeText(MainActivity.this, carString, Toast.LENGTH_SHORT).show();

Thanks for tips and support.

Activity

  1. ISchwarz23 commented on Sep 11, 2021

    @ISchwarz23
    Owner

    Hi @Hessu007,

    unfortunately, you can't listen for cell clicks. All clicks are related to a table item/row.

    But in case you always want to get the first column value of the clicked row, you can implement it like this:

    public void onDataClicked(int rowIndex, String[] strings) {
            final String contentOfFirstCell = strings[0];
            Toast.makeText(MainActivity.this, contentOfFirstCell, Toast.LENGTH_SHORT).show();
    }

    Kind regards

  2. baneeishaque commented on Sep 11, 2021

    @baneeishaque

    what about - using strings[columnIndex]? @Hessu007

  3. ISchwarz23 commented on Sep 12, 2021

    @ISchwarz23
    Owner

    Unfortunately this is not possible. The click listener does not respect the column, only the row.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions