Android Question Error ACMenu and Toolbar - Error load 2nd activity

Aviles

Member
Licensed User
Longtime User
Hello,
please can someone help me to fix this error?

I'm having a error when I try to load the ACToolbar in a second activity, in the first activity (main) loads perfect, but if i try to load it in the second activity, crashes.

thanks.

B4A Ver. 7.01

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity2) Create, isFirst = true **
Error occurred on line: 35 (activity2)
java.lang.RuntimeException: java.lang.ClassCastException: b4a.example.activity2 cannot be cast to android.support.v7.app.AppCompatActivity
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at b4a.example.activity2.afterFirstLayout(activity2.java:102)
at b4a.example.activity2.access$000(activity2.java:17)
at b4a.example.activity2$WaitForLayout.run(activity2.java:80)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.ClassCastException: b4a.example.activity2 cannot be cast to android.support.v7.app.AppCompatActivity
at de.amberhome.objects.appcompat.ACToolBarWrapper.DesignerCreateView(ACToolBarWrapper.java:119)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:70)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 17 more
 

Attachments

You need to add the line from the main here too where you add the line for appcompat to extend the activity to be a apcompatctivity.
This must be done in every appcompat activity.
 
Upvote 0
You need to add the line from the main here too where you add the line for appcompat to extend the activity to be a apcompatctivity.
This must be done in every appcompat activity.

Great !
It works !

thanks so much DonManfred.

I thought #Extends: android.supportv7.... was Global and only you needed put only in main
 
Upvote 0
Back
Top