After I compile the b4a test project I get an error in the log
B4X:
** Activity (main) Create, isFirst = true **
Class returned class java.lang.Class
main_activity_create (java line: 248)
java.lang.IllegalArgumentException: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{barxdroid.nbtest/java.lang.Class}
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:197)
at barxdroid.NotificationBuilder.NotificationBuilder.Notify(NotificationBuilder.java:116)
at barxdroid.nbtest.main._activity_create(main.java:248)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at barxdroid.nbtest.main.afterFirstLayout(main.java:85)
at barxdroid.nbtest.main.access$100(main.java:16)
at barxdroid.nbtest.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4575)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{barxdroid.nbtest/java.lang.Class}
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:223)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:264)
at android.support.v4.app.NavUtils.getParentActivityIntent(NavUtils.java:211)
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:190)
... 17 more
java.lang.IllegalArgumentException: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{barxdroid.nbtest/java.lang.Class}
I have also tried creating a testing method to that does
B4X:
return pActivity.getClass().toString();
And all it ever seems to return is 'java.lang.Class'
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 246)
java.lang.NullPointerException
at barxdroid.NotificationBuilder.NotificationBuilder.Notify(NotificationBuilder.java:116)
at barxdroid.nbtest.main._activity_create(main.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at barxdroid.nbtest.main.afterFirstLayout(main.java:85)
at barxdroid.nbtest.main.access$100(main.java:16)
at barxdroid.nbtest.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4575)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
LogCat connected to: SH0BCRT05610
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
java.lang.Class
main_activity_create (java line: 250)
java.lang.IllegalArgumentException: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{barxdroid.nbtest/java.lang.Class}
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:197)
at barxdroid.NotificationBuilder.NotificationBuilder.Notify(NotificationBuilder.java:195)
at barxdroid.nbtest.main._activity_create(main.java:250)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at barxdroid.nbtest.main.afterFirstLayout(main.java:85)
at barxdroid.nbtest.main.access$100(main.java:16)
at barxdroid.nbtest.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4575)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{barxdroid.nbtest/java.lang.Class}
at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:223)
at android.support.v4.app.NavUtils.getParentActivityName(NavUtils.java:264)
at android.support.v4.app.NavUtils.getParentActivityIntent(NavUtils.java:211)
at android.support.v4.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:190)
... 17 more
java.lang.IllegalArgumentException: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{barxdroid.nbtest/java.lang.Class}
Any Ideas?
the 'java.lang.Class in the log just before the Main_Activity_Create is what is returned from
It's typically obtuse (I find the Android documentation is usually totally unhelpful) but the standard Basic4android manifest doesn't seem to have a <meta-data> tag so maybe it's complaining about the lack of a name attribute in the meta-data.
Here's something you can try. I get no error with this code (ActModName is the activity module name as it appears in B4A, e.g. "Main" for the main activity):
This is a wild guess and you may have tried this already! The Android docs for TaskStackBuilder.addParentStack(Class<?> sourceActivityClass) say
It's typically obtuse (I find the Android documentation is usually totally unhelpful) but the standard Basic4android manifest doesn't seem to have a <meta-data> tag so maybe it's complaining about the lack of a name attribute in the meta-data.
Here's something you can try. I get no error with this code (ActModName is the activity module name as it appears in B4A, e.g. "Main" for the main activity):
ComponentName cn = new ComponentName(pn, "." + pActivity.toLowerCase((BA.cul)));
Sill get the same error but as you can see from the log, the name now looks right.
B4X:
** Activity (main) Create, isFirst = true **
-3
java.lang.String
ComponentInfo{barxdroid.nbtest/.main2}
main_activity_create (java line: 250)
java.lang.NoSuchMethodError: android.support.v4.app.TaskStackBuilder.addParentStack
at barxdroid.NotificationBuilder.NotificationBuilder.Notify(NotificationBuilder.java:201)
at barxdroid.nbtest.main._activity_create(main.java:250)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at barxdroid.nbtest.main.afterFirstLayout(main.java:85)
at barxdroid.nbtest.main.access$100(main.java:16)
at barxdroid.nbtest.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4575)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
You have a problem with the support library. "NoSuchMethodError" means the library does not contain a method "addParentStack", but the documentation and my own test prove that it is a method of TaskStackBuilder, without any doubt, and it is included in the support library. So you have a problem with your library. You should get the latest version.
You have a problem with the support library. "NoSuchMethodError" means the library does not contain a method "addParentStack", but the documentation and my own test prove that it is a method of TaskStackBuilder, without any doubt, and it is included in the support library. So you have a problem with your library. You should get the latest version.
No, it looks wrong. The right name is the one you got first.
Are you saying there is a problem with the support library file I am using?
it is the one included in latest SDK. The addParentStack method comes up (and was selected) from the auto-complete in eclipse. So, you saying I should try and download another copy from somewhere?
Are you saying there is a problem with the support library file I am using?
it is the one included in latest SDK. The addParentStack method comes up (and was selected) from the auto-complete in eclipse. So, you saying I should try and download another copy from somewhere?