I'm using gowong/material-sheet-fab but it's showing me errors .Can anyone help me out?

Internet of Things IoT Frameworks 3 years ago

4.08K 1 0 0 0

_x000D_ _x000D_ Here is my Fab Activity public class Fab extends FloatingActionButton implements AnimatedFab { public Fab(Context context) { super(context); } @Override public void show() { show(0, 0); } @SuppressLint("RestrictedApi") @Override public void show(float translationX, float translationY) { setVisibility(View.VISIBLE); } /** * Hides the FAB. */ @SuppressLint("RestrictedApi") @Override public void hide() { setVisibility(View.INVISIBLE); } } Here is my Main Activity // MATERIAL ANIMATED FAB Fab fab = findViewById(R.id.fab); View sheetView = findViewById(R.id.fab_sheet); View overlay = findViewById(R.id.overlay); int sheetColor = getResources().getColor(R.color.fab_sheet_color); int fabColor = getResources().getColor(R.color.fab_color); // Initialize material sheet FAB materialSheetFab = new MaterialSheetFab<>(fab, sheetView, overlay, sheetColor, fabColor); materialSheetFab.setEventListener(new MaterialSheetFabEventListener() { @Override public void onShowSheet() { // Called when the material sheet's "show" animation starts. } @Override public void onSheetShown() { // Called when the material sheet's "show" animation ends. } @Override public void onHideSheet() { // Called when the material sheet's "hide" animation starts. } public void onSheetHidden() { // Called when the material sheet's "hide" animation ends. } }); Here is my logcat Process: com.teepe.teepe, PID: 29259 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.teepe.teepe/com.teepe.teepe.MainActivity}: java.lang.ClassCastException: android.support.design.widget.FloatingActionButton cannot be cast to com.teepe.teepe.Fab at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) Caused by: java.lang.ClassCastException: android.support.design.widget.FloatingActionButton cannot be cast to com.teepe.teepe.Fab at com.teepe.teepe.MainActivity.onCreate(MainActivity.java:95) at android.app.Activity.performCreate(Activity.java:6662) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6077)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago
_x000D_ As the error says, Caused by: java.lang.ClassCastException: android.support.design.widget.FloatingActionButton cannot be cast to com.teepe.teepe.Fab at com.teepe.teepe.MainActivity.onCreate(MainActivity.java:95), in your MainActivity, check this line of code from the library you used: Change your
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum


Q

Azure IoT hub and sending messages with mosquitto_pub

_x000D_ _x000D_ I'm trying to send some simple message with mosquitto_pub to Azure IoT HUB but faced...
Q

How to generate AWS bootstrap certificates with java SDK?

_x000D_ _x000D_ According to this docs I need to generate so-called bootstrap certificates for my Io...
Q

is it possible to do 3way handshake only one time with mqtt communication?

_x000D_ _x000D_ I am using mosquitto_pub to publish the data with TLS using a topic. I am using mosq...

Important Internet of Things Links