android - ShowCaseView Target from another Layout -
my main activity inflate activity_main.xml
setcontentview(r.layout.activity_main);
in activity main have recyclerview view:
<android.support.v7.widget.recyclerview android:id="@+id/readlist" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/layoutlistarspiner" android:layout_alignparentstart="true" />
for recyclerview items have layout, recycleritemlist inflated adapter:
public mycustomholder oncreateviewholder(viewgroup viewgroup, int i) { view itemview = layoutinflater. from(viewgroup.getcontext()). inflate(r.layout.recycleritemlist, viewgroup, false); return new mycustomholder(itemview); }
and inside recyclerviewlist have imagebutton want set showcaseview point:
<imagebutton android:id="@+id/status" android:layout_width="38dp" android:background="@null" android:scaletype="centerinside" android:src="@drawable/favorite" android:paddingleft="4dp" android:paddingright="4dp" android:layout_height="wrap_content" android:layout_centervertical="true" />
but showcaseview keep showing me null pointer:
java.lang.nullpointerexception: attempt invoke virtual method 'void android.view.view.getlocationinwindow(int[])' on null object reference
thats because r.id.status returning null
viewtarget target = new viewtarget(r.id.status, main);
the showcasecode highlight
viewtarget target = new viewtarget(r.id.status, main); new showcaseview.builder(main) .settarget(target) .setcontenttitle("test 1 - status") .setcontenttext("this status button") .hideontouchoutside() .build(); }
how can make r.id.status acessible/not null?
Comments
Post a Comment