Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Hessu007 opened this issue Sep 11, 2021 · 3 comments

Comments

@Hessu007
Copy link

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.

@ISchwarz23
Copy link
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

@Baneeishaque
Copy link

what about - using strings[columnIndex]? @Hessu007

@ISchwarz23
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants