Java Question How To get Bundle

hanyelmehy

Active Member
Licensed User
Longtime User
i need to make new library ,one of API argument need Bundle
in Java code :
you can get savedInstanceState as Bundle and pass it to API but how to make this in library because activity well created in B4A

B4X:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
function.showSplash(this, savedInstanceState);

Thank you
 

hanyelmehy

Active Member
Licensed User
Longtime User
yes i was try this ,but when i try to run this API from B4A i get error
B4X:
android.content.res.Resources$NotFoundException: String resource ID #0x0
    at android.content.res.Resources.getText(Resources.java:260)
    at android.content.res.Resources.getString(Resources.java:344)
    at com.startapp.android.publish.splash.SplashConfig.validate(Unknown Source)
    at com.startapp.android.publish.splash.a.e(Unknown Source)
    at com.startapp.android.publish.splash.a.a(Unknown Source)
    at com.startapp.android.publish.splash.a$1.run(Unknown Source)
    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:4517)
    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:993)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
    at dalvik.system.NativeStart.main(Native Method)

i also try to add :
B4X:
private Bundle savedInstanceState;
and pass savedInstanceState directly to API ,....Same error
 
Last edited:

warwound

Expert
Licensed User
Longtime User
yes i was try this ,but when i try to run this API from B4A i get error
B4X:
android.content.res.Resources$NotFoundException: String resource ID #0x0
    at android.content.res.Resources.getText(Resources.java:260)
    at android.content.res.Resources.getString(Resources.java:344)
    at com.startapp.android.publish.splash.SplashConfig.validate(Unknown Source)
    at com.startapp.android.publish.splash.a.e(Unknown Source)
    at com.startapp.android.publish.splash.a.a(Unknown Source)
    at com.startapp.android.publish.splash.a$1.run(Unknown Source)
    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:4517)
    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:993)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
    at dalvik.system.NativeStart.main(Native Method)

i also try to add :
B4X:
private Bundle savedInstanceState;
and pass savedInstanceState directly to API ,....Same error

Seems as though you're trying to wrap an 'android library project'.
The android library project contains resources and these resources are not being compiled into your application.

Search the forum for usage of the AdditionalRes project attribute - it'll enable you to have additional resources - such as those contained in an android library project - compiled into your application.

Martin.
 

hanyelmehy

Active Member
Licensed User
Longtime User
Hi,
all other functions work ,all needed resources are included
the only API that make a problem this on
Thank you
 

warwound

Expert
Licensed User
Longtime User
If the java code cannot find a resource then it returns the integer value 0 as the resource identifier for the requested resource.
So:

Resources$NotFoundException: String resource ID #0x0

Means that a string resource has been requested somewhere in the java but not found - the requested string resource has either:
  • Not been compiled into the apk file.
  • The string resource has been compiled into the apk file but it's not available under the package name being used by the java code.

Try this:
  • Compile your project.
  • Open the project's Objects\gen\<packagename>\R.java file in a text editor.
  • Look for the public static final class string, there may not be such a class defined.
  • Do you see any lines:
    public static final int <string-resource-name-here>=????;

If R.java doesn't contain a reference to the string resource your java code is requesting then that'll explain the exception.

Martin.
 

hanyelmehy

Active Member
Licensed User
Longtime User
If the java code cannot find a resource then it returns the integer value 0 as the resource identifier for the requested resource.
So:

Resources$NotFoundException: String resource ID #0x0

Means that a string resource has been requested somewhere in the java but not found - the requested string resource has either:
  • Not been compiled into the apk file.
  • The string resource has been compiled into the apk file but it's not available under the package name being used by the java code.

Try this:
  • Compile your project.
  • Open the project's Objects\gen\<packagename>\R.java file in a text editor.
  • Look for the public static final class string, there may not be such a class defined.
  • Do you see any lines:
    public static final int <string-resource-name-here>=????;

If R.java doesn't contain a reference to the string resource your java code is requesting then that'll explain the exception.

Martin.
Thank you ,i well try
 
Top