Closed tej5530 closed 6 years ago
Hello @tej5530 Thank you for providing me with this possible bug. Can you provide a complete (or semi-complete) file so I can better assess the situation?
Regards,
i create this method inside in oncreate. private void intiFlotingMenu() { // fab_1 = (FloatingMenuButton) findViewById(R.id.fab_1); // fab_1.setStartAngle(0) Here i got an Exception of null pointer // .setEndAngle(360) // .setAnimationType(AnimationType.EXPAND) // .setAnchored(false); // fab_1.getAnimationHandler() // .setOpeningAnimationDuration(500) // .setClosingAnimationDuration(200) // .setLagBetweenItems(0) // .setOpeningInterpolator(new FastOutSlowInInterpolator()) // .setClosingInterpolator(new FastOutLinearInInterpolator()) // .shouldFade(true) // .shouldScale(true) // .shouldRotate(false) // ; }
//this is my view xml file
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:floatingMenuActionButton="http://schemas.android.com/tools" android:id="@+id/pai" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:background="#22222A">
<android.support.constraint.Guideline
android:id="@+id/gl_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"/>
<android.support.constraint.Guideline
android:id="@+id/gl_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="1.0"/>
<rjsv.floatingmenu.floatingmenubutton.FloatingMenuButton
android:id="@+id/fab_2"
android:layout_width="60dp"
android:layout_height="60dp"
android:scaleType="centerInside"
app:layout_constraintBottom_toTopOf="@+id/gl_2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/gl_1"
floatingMenuActionButton:dispositionEndAngle="360"
floatingMenuActionButton:dispositionStartAngle="0"
floatingMenuActionButton:subActionButtonRadius="100"
app:layout_constraintHorizontal_bias="0.833"
app:layout_constraintVertical_bias="0.805">
<rjsv.floatingmenu.floatingmenubutton.subbutton.FloatingSubButton
android:id="@+id/fab_2_sub_fab_left_1"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/ic_menu_camera"/>
<rjsv.floatingmenu.floatingmenubutton.subbutton.FloatingSubButton
android:id="@+id/fab_2_sub_fab_left_2"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/ic_menu_gallery"/>
<rjsv.floatingmenu.floatingmenubutton.subbutton.FloatingSubButton
android:id="@+id/fab_2_sub_fab_left_3"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/ic_menu_manage"/>
<rjsv.floatingmenu.floatingmenubutton.subbutton.FloatingSubButton
android:id="@+id/fab_2_sub_fab_left_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/ic_menu_send"/>
<rjsv.floatingmenu.floatingmenubutton.subbutton.FloatingSubButton
android:id="@+id/fab_2_sub_fab_left_5"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/ic_menu_slideshow"/>
</rjsv.floatingmenu.floatingmenubutton.FloatingMenuButton>
</android.support.constraint.ConstraintLayout>
// i call this file in my main layout file.
Hello @tej5530 I have replicated an activity using your code and noticed that you have an error on your code. In your private method you are using the viewId 'fab_1' instead of 'fab_2'. In your .xml file there is no 'fab_1' (at least on the one you have shown)
private void intiFlotingMenu() {
// fab_1 = (FloatingMenuButton) findViewById(R.id.fab_1);
// fab_1.setStartAngle(0) Here i got an Exception of null pointer
Since your findViewById(R.id.fab_1) is not finding the fab_1 button, the fab_1 view reference is null and therefore crashes. Try and change it to :
private void intiFlotingMenu() {
// fab_1 = (FloatingMenuButton) findViewById(R.id.fab_2); // notice the 'fab_2' here
// fab_1.setStartAngle(0) Here i got an Exception of null pointer
Best regards,
Attempt to invoke virtual method 'rjsv.floatingmenu.floatingmenubutton.FloatingMenuButton rjsv.floatingmenu.floatingmenubutton.FloatingMenuButton.setStartAngle(int)' on a null object reference