xml - Android: FloatingActionButton leads to "Unable to start activity ComponentInfo" -


i have floating button in fragment , wants pass intent activity. however, when press floating button, leads "unable start activity componentinfo" error.

below logcat:

01-29 15:51:07.361 5909-5909/com.example.l33902.contactmanagment1512 e/androidruntime: fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.example.l33902.contactmanagment1512/com.example.l33902.contactmanagment.createcontactlistactivity}: java.lang.nullpointerexception: println needs message @ android.app.activitythread.performlaunchactivity(activitythread.java:3155) @ android.app.activitythread.handlelaunchactivity(activitythread.java:3263) @ android.app.activitythread.access$1000(activitythread.java:197) @ android.app.activitythread$h.handlemessage(activitythread.java:1687) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:145) @ android.app.activitythread.main(activitythread.java:6897) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1404) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1199) caused by: java.lang.nullpointerexception: println needs message @ android.util.log.println_native(native method) @ android.util.log.d(log.java:164) @ com.example.l33902.contactmanagment.createcontactlistactivity.oncreate(createcontactlistactivity.java:45) @ android.app.activity.performcreate(activity.java:6550) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1120) @ android.app.activitythread.performlaunchactivity(activitythread.java:3108) @ android.app.activitythread.handlelaunchactivity(activitythread.java:3263)  @ android.app.activitythread.access$1000(activitythread.java:197)  @ android.app.activitythread$h.handlemessage(activitythread.java:1687)  @ android.os.handler.dispatchmessage(handler.java:102)  @ android.os.looper.loop(looper.java:145)  @ android.app.activitythread.main(activitythread.java:6897)  @ java.lang.reflect.method.invoke(native method)  @ java.lang.reflect.method.invoke(method.java:372)  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1404)  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1199) 

this xml codes:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/plannerlinearlay"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">      <listview         android:id="@+id/lvcontactscategories"         android:layout_width="match_parent"         android:layout_height="match_parent" />      <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentright="true">          <android.support.design.widget.floatingactionbutton             android:id="@+id/fabaddconlist"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="bottom"             android:layout_margin="16dp"             app:borderwidth="0dp"             android:clickable="true"             android:src="@drawable/ic_add_white" />     </linearlayout>  </relativelayout> 

-----------------edit-------------------

below codes intent:

 floatingactionbutton fab;  fab = (floatingactionbutton) rootview.findviewbyid(r.id.fabaddconlist);         fab.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 intent createcontactlist = new intent(context, createcontactlistactivity.class);                 createcontactlist.addflags(intent.flag_activity_no_animation);                 startactivity(createcontactlist);             }         }); 

this same error here:
how startactivity using actionbar item
see line in logcat:

com.example.l33902.contactmanagment.createcontactlistactivity.oncreate(createcontactlistactivity.java:45) 

it states have error in createcontactlistactivity.java on line 45.


Comments