how to notify RecyclerView which is added as a child to LinearLayout in Android
<p>I was about to implement a recyclerView within recyclerView and finally I figured out that I can implement it as LinearLayout which host my RecyclerViews. </p>

<pre><code>RecyclerView rv = new RecyclerView(this);
rv.setLayoutParams(new GridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this, 3);
rv.setHasFixedSize(true);
rv.setLayoutManager(layoutManager);
rv.setAdapter(new Adapter(...));

hostLinearLayout.addView(rvSingleMonth);
</code></pre>

<p>Now I want to notify all those RecyclerView as a child of LinearLayout, simultaniously.</p>

<pre><code>if (llRootView != null) {
    for (int idx = 0; idx &lt; hostLinearLayout.getChildCount(); idx++) {
        try {
            RecyclerView currentRv = (RecyclerView) hostLinearLayout.getChildAt(idx);
            currentRv.getAdapter().notifyDataSetChanged();
        } catch (Exception e){

        }
    }
}
</code></pre>

<p>But it does't work!!! can anyOne help me out?</p>

<p><strong>Edit</strong></p>

<p>by "it does't work", I mean when I try to notify recyclerView (as a child of hostLinearLayout) as it shown above, </p>

<pre><code>RecyclerView currentRv = (RecyclerView) hostLinearLayout.getChildAt(idx);
currentRv.getAdapter().notifyDataSetChanged();
</code></pre>

<p>notifying doesn't apply changes And it make application lag.</p>