java - Android recyclerview in a recyclerview item -
i building app school project, want making week planner students in app. need add recyclerview in recyclerview item, when run app shows nothing. think error in
logcat:06-19 15:43:36.926 2980-2980/com.sapps.tools.dedykapp e/recyclerview﹕ no adapter attached; skipping layout.
here code:
planneractivity.java
//day planner monday arraylist<dayitems> mon = new arraylist<>(); mon.add(new dayitems("huiswerk maken")); linearlayout v = (linearlayout)getlayoutinflater().inflate(r.layout.dayitems, viewgroup); recyclerview dayplan = (recyclerview)v.findviewbyid(r.id.mon); dayplan.sethasfixedsize(true); linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(this); linearlayoutmanager.setorientation(linearlayoutmanager.vertical); dayplan.setlayoutmanager(linearlayoutmanager); dayrecadapter dayadapter = new dayrecadapter(mon); dayplan.setadapter(dayadapter); //planner recyclerview plan = (recyclerview)findviewbyid(r.id.planner); plan.sethasfixedsize(true); linearlayoutmanager linmanager = new linearlayoutmanager(this); linmanager.setorientation(linearlayoutmanager.vertical); plan.setlayoutmanager(linmanager); plannerrecadapter recadapter = new plannerrecadapter(r.layout.dayitems); plan.setadapter(recadapter);
both of adapters agenda:
adapter of todo list inside recyclerview item:
public class dayrecadapter extends recyclerview.adapter<dayviewholder> { arraylist<dayitems> mlist; public dayrecadapter(arraylist<dayitems> mlist){ this.mlist = mlist; } public int getitemcount(){ return mlist.size(); } public dayviewholder oncreateviewholder(viewgroup viewgroup, int position){ view v = layoutinflater.from(viewgroup.getcontext()).inflate(r.layout.planitem, viewgroup, false); dayviewholder dvh = new dayviewholder(v); return dvh; } public void onbindviewholder(dayviewholder vholder, int i){ vholder.daytext.settext(mlist.get(i).todo); } }
adapter of main recyclerview:
public class plannerrecadapter extends recyclerview.adapter<plannerviewholder> { int layoutresource; public plannerrecadapter(int layoutresource){ this.layoutresource = layoutresource; } public int getitemcount(){ return 1; } public plannerviewholder oncreateviewholder(viewgroup viewgroup, int position){ view v = layoutinflater.from(viewgroup.getcontext()).inflate(layoutresource, viewgroup, false); plannerviewholder pvh = new plannerviewholder(v); return pvh; } public void onbindviewholder(plannerviewholder holder, int i){ } }
and here layout resource of plannerrecadapter:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/plancard" android:layout_width="fill_parent" android:layout_height="wrap_content" card_view:cardcornerradius="4dp" card_view:cardbackgroundcolor="#9ccc65" android:layout_margin="13dp"> <textview android:id="@+id/dagtxt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="@color/text2" android:textsize="15dp" android:textstyle="bold" android:padding="14dp" android:text="maandag"/> <android.support.v7.widget.recyclerview android:id="@+id/mon" android:layout_height="wrap_content" android:layout_width="fill_parent" android:padding="14dp" android:scrollbars="vertical" /> </android.support.v7.widget.cardview>
logcat:
reconstruct branch: au_linux_android_la.bf.1.1.04.04.02.162.107 + cb93e16 + f50fe49 + d7c18e6 + 5b9a565 + 0f3a25d + 607156e + 75511aa + e4d16c0 + 686f3eb + 211a271 + dd281ee + nothing 06-19 15:43:34.142 2980-3015/com.sapps.tools.dedykapp w/audiomanagerandroid﹕ requires bluetooth permission 06-19 15:43:34.184 2980-3013/com.sapps.tools.dedykapp w/chromium﹕ [warning:data_reduction_proxy_config.cc(318)] spdy proxy off @ startup 06-19 15:43:34.220 2980-2980/com.sapps.tools.dedykapp w/art﹕ attempt remove local handle scope entry irt, ignoring 06-19 15:43:34.235 2980-2980/com.sapps.tools.dedykapp w/awcontents﹕ ondetachedfromwindow called when detached. ignoring 06-19 15:43:34.350 2980-3030/com.sapps.tools.dedykapp d/openglrenderer﹕ render dirty regions requested: true 06-19 15:43:34.359 2980-2980/com.sapps.tools.dedykapp d/atlas﹕ validating map... 06-19 15:43:34.417 2980-3030/com.sapps.tools.dedykapp i/openglrenderer﹕ initialized egl, version 1.4 06-19 15:43:34.423 2980-3030/com.sapps.tools.dedykapp d/openglrenderer﹕ enabling debug mode 0 06-19 15:43:34.576 2980-3046/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_attachment:854>: invalid texture format! returning error! 06-19 15:43:34.576 2980-3046/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_object_status:1237>: framebuffer color attachment incomplete. returning gl_framebuffer_incomplete_attachment! 06-19 15:43:34.622 2980-3030/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_attachment:854>: invalid texture format! returning error! 06-19 15:43:34.622 2980-3030/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_object_status:1237>: framebuffer color attachment incomplete. returning gl_framebuffer_incomplete_attachment! 06-19 15:43:34.884 2980-2980/com.sapps.tools.dedykapp w/bindingmanager﹕ cannot call determinedvisibility() - never saw connection pid: 2980 06-19 15:43:36.742 2980-2980/com.sapps.tools.dedykapp e/recyclerview﹕ no adapter attached; skipping layout 06-19 15:43:36.926 2980-2980/com.sapps.tools.dedykapp e/recyclerview﹕ no adapter attached; skipping layout 06-19 15:43:41.519 2980-2991/com.sapps.tools.dedykapp i/art﹕ debugger no longer active 06-19 15:59:14.349 2980-2980/com.sapps.tools.dedykapp w/art﹕ attempt remove local handle scope entry irt, ignoring 06-19 15:59:14.355 2980-2980/com.sapps.tools.dedykapp w/awcontents﹕ ondetachedfromwindow called when detached. ignoring 06-19 15:59:14.684 2980-2980/com.sapps.tools.dedykapp w/bindingmanager﹕ cannot call determinedvisibility() - never saw connection pid: 2980 06-19 15:59:14.902 2980-3030/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_attachment:854>: invalid texture format! returning error! 06-19 15:59:14.902 2980-3030/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_object_status:1237>: framebuffer color attachment incomplete. returning gl_framebuffer_incomplete_attachment! 06-19 15:59:21.278 2980-2980/com.sapps.tools.dedykapp w/art﹕ attempt remove local handle scope entry irt, ignoring 06-19 15:59:21.284 2980-2980/com.sapps.tools.dedykapp w/awcontents﹕ ondetachedfromwindow called when detached. ignoring 06-19 15:59:21.527 2980-2980/com.sapps.tools.dedykapp w/bindingmanager﹕ cannot call determinedvisibility() - never saw connection pid: 2980 06-19 15:59:21.809 2980-3030/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_attachment:854>: invalid texture format! returning error! 06-19 15:59:21.809 2980-3030/com.sapps.tools.dedykapp e/adreno-es20﹕ <check_framebuffer_object_status:1237>: framebuffer color attachment incomplete. returning gl_framebuffer_incomplete_attachment! 06-19 15:59:25.131 2980-2980/com.sapps.tools.dedykapp e/recyclerview﹕ no adapter attached; skipping layout 06-19 15:59:25.182 2980-2980/com.sapps.tools.dedykapp e/recyclerview﹕ no adapter attached; skipping layo
thanks in advance!
try this.
in planneractivity.java declare
private recyclerview.adapter adapter
then in oncreate method, find this.
adapter = new dayrecadapter(mon);
hope solve no adapter attached issue
Comments
Post a Comment