question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to get the BaseViewHolder helper instance in activity onItemChildClick

See original GitHub issue
 @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                super.onItemChildClick(adapter, view, position);
                switch (view.getId()) {

                  
                    case R.id.tweetAvatar:
                        Toast.makeText(RecyclerClickItemActivity.this, "The " + Integer.toString(position)+" tweetAvatar  is clicked", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.tweetName:
                        Toast.makeText(RecyclerClickItemActivity.this, "The " + Integer.toString(position)+" 

//      BaseViewHolder helper=(BaseViewHolder) mRecyclerView.getChildViewHolder(view); Toast.LENGTH_SHORT).show();
                        break;
                    default:
                        break;
                }

I want BaseViewHolder helper instance to get other the view from item

ex: click on tweet name I should get bitmape drawable of tweetAvatar or any image view form the item !!

or

simply how do this helper.getView(R.id.tweetAvatar)); in activity onItemChildClick?? with position!!!

Tried with BaseViewHolder helper=(BaseViewHolder) mRecyclerView.getChildViewHolder(view); not working

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CymChadcommented, Dec 6, 2016

@tysheng Thank you for your answer,Another method by changing the data source to change the view of the item, not directly manipulate the view of the item

1reaction
tyshengcommented, Dec 6, 2016

Don’t do like this, use view.getParent() and cast into ViewGroup, then findViewById()

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I get Activity from RecyclerView.ViewHolder ...
Typically you would have one NavHostFragment per activity. Navigation — helper class for obtaining NavController instance and for connecting ...
Read more >
com.chad.library.adapter.base.listener.OnItemClickListener
Example 1 with OnItemClickListener. use of com.chad.library.adapter.base.listener.OnItemClickListener in project BaseRecyclerViewAdapterHelper by CymChad.
Read more >
com.chad.library.adapter.base.listener.OnItemDragListener
INSTANCE.e(TAG, "view swiped start: " + pos); } @Override public void clearView(RecyclerView. ... case 0: convert((BaseViewHolder) holder, mData.get(holder.
Read more >
com.chad.library.adapter.base.BaseQuickAdapter Java Exaples
Example #1 ... getData().get(position); Help help; if (!StringUtil.trim(item. ... @Override public void onItemChildClick(BaseQuickAdapter adapter, ...
Read more >
RecycleView的通用适配器BaseQuickAdapter处理item中子 ...
setText(R.id.tv_shopName, (CharSequence) item.get("shopName")) . ... @Override public void onItemChildClick(BaseQuickAdapter adapter, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found