This is my log. I added two buttons and tried to tie it to and activity.
Process: com.example.max_poly.driverecord, PID: 1553
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.max_poly.driverecord/com.example.max_poly.driverecord.MenuActivity}: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button
at com.example.max_poly.driverecord.MenuActivity.onCreate(MenuActivity.java:20)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
btRecordPath_.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(MenuActivity.this, MapActivitySecond.class);
MenuActivity.this.startActivity(myIntent);
}
});
}
}
the logcat points the line 20 which is where I put the /**/
*
* *
Edit:
Well I solved the problem.
1- In my activity I should have declared the buttons as FancyButton instead of Button
2- In my androidManifest I should have registered my activity by adding <activity android:name=".MapActivitySecond"
android:configChanges="orientation|screenSize"/> under the main activity in the application tag.
Very easy going library, thanks again
This is my log. I added two buttons and tried to tie it to and activity.
Process: com.example.max_poly.driverecord, PID: 1553 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.max_poly.driverecord/com.example.max_poly.driverecord.MenuActivity}: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: mehdi.sakout.fancybuttons.FancyButton cannot be cast to android.widget.Button at com.example.max_poly.driverecord.MenuActivity.onCreate(MenuActivity.java:20) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method)
layout code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:fancy="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
activity code: public class MenuActivity extends Activity { private Button btRecordPath; private Button btHistory;
/**/ btRecordPath_ = (Button)findViewById(R.id.btnrecordPath); // btHistory = (Button) findViewById(R.id.btn_history);
}
the logcat points the line 20 which is where I put the /**/
Edit:
Well I solved the problem. 1- In my activity I should have declared the buttons as FancyButton instead of Button 2- In my androidManifest I should have registered my activity by adding <activity android:name=".MapActivitySecond" android:configChanges="orientation|screenSize"/> under the main activity in the application tag. Very easy going library, thanks again