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

OnclickListner #22

Open
dhinakaranK opened this issue Jul 3, 2018 · 3 comments
Open

OnclickListner #22

dhinakaranK opened this issue Jul 3, 2018 · 3 comments

Comments

@dhinakaranK
Copy link

How to set OnClick listner to get selected value

@dhinakaranK
Copy link
Author

How to add search to treeview

@dhinakaranK
Copy link
Author

How to add filter

@ExCx
Copy link

ExCx commented Sep 6, 2019

To get the selected value, what I did was adding an invisible TextView under the ViewHolder layout's root. It holds the ID value like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/item_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone"/>

Then into the click event I can get the ID value like this:

public boolean onClick(View v) { var id = (TextView)(((LinearLayout)v).getChildAt(0));

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

2 participants