Android Question Error: android.content.res.Resources$NotFoundException: Resource ID #0x0

JOTHA

Well-Known Member
Licensed User
Longtime User
Hi experts,

I have an app which worked fine, but since I've installed the upgrade B4A Version 8.30, there is an error-message when I click on an EditTextView (after that the app closes):

android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:197)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2317)
at android.content.res.Resources.getLayout(Resources.java:1268)
at android.view.LayoutInflater.inflate(LayoutInflater.java:424)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.widget.Editor$SuggestionsPopupWindow.initContentView(Editor.java:3382)
at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:3038)
at android.widget.Editor$SuggestionsPopupWindow.<init>(Editor.java:3348)
at android.widget.Editor.replace(Editor.java:361)
at android.widget.Editor$3.run(Editor.java:2143)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6310)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)

On an Android Device with Android-Version 4.0.4 there are no error-messages, the app works well, but on another Device with Android-Version 7.1.1 the app doesn't work.

Does someone know the reason why?
 

DonManfred

Expert
Licensed User
Longtime User
Where is the project upload?
Seems like you aare missing a Resource needed.Forgot to add #AdditionalRes line in your project?

You need to provide more informations
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
... you changed the theme or the targetSdkVersion
Yes, I think that I changed the minSDKVersion in the manifest, I deletet this entry in the manifest:
AddManifestText(
<uses-sdk android:minSdkVersion="4" /> ...)
Now I put it back, but the error-message is always here ...
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
then your app is running with Android 2 theme
Yes Erel, I wanted to run the in this old style ...

Now I have put this line to the manifest editor:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>

The result is that the "android.content.res.Resources$NotFoundException: Resource ID #0x0"-problem is solved.

But now I have a many other problems, for example:
  • How can I reduce the Activity.Title Text.size?
  • How can I change the Activity.Title Background Color?
  • How can I change the Activity.Title Height?
  • Before that I had EditText with white background, black Text and borders, now I have to change everything ...
  • Before that I had Buttons with Labels and ImageViews on top, now they are not visible ...
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You wrote:
I have an app which worked fine, but since I've installed the upgrade B4A Version 8.30, there is an error-message when I click on an EditTextView (after that the app closes):
The error has nothing to do with B4A v8.30.


  • How can I reduce the Activity.Title Text.size?
  • How can I change the Activity.Title Background Color?
You can use CSBuilder to change the text style.

There is no simple way to change the Title height. You might be able to do it with AppCompat. However you should think about it and decide whether you want to use the standard theme like all other apps or you want to imitate the Android 2 theme and make your app look strange.

Before that I had EditText with white background, black Text and borders, now I have to change everything ...
That's true. I recommend you to set the text color to "default" (delete the color value in the designer).

Before that I had Buttons with Labels and ImageViews on top, now they are not visible ...
Buttons are elevated in the material theme. You can use Panels instead.
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
Buttons are elevated
... that means, Buttons are always in "BringToFront-Modus" and "ImageView1.BringToFront" doesn't work.
I have to use Panels or Labels for that.
recommend you to set the text color to "default"
... or I underlay a Label in Colors.White.
you want to imitate the Android 2 theme
Is there another easy way to do that and use it together with android:targetSdkVersion="26"? o_O
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
that means, Buttons are always in "BringToFront-Modus" and "ImageView1.BringToFront" doesn't work.
This means that you need to put the ImageView in a Panel and set the panel elevation. However this is not the best way to create a button with images. There are simpler ways.

Is there another easy way to do that and use it together with android:targetSdkVersion="26"?
You can set the old theme with targetSdkVersion however your app will fail on some devices.
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
Hello Erel,
thank you for the information.
This means that you need to put the ImageView in a Panel
I put it on a Label ... and it works also. Is there any advantage caused by the elevation?
... however your app will fail on some devices
... so that will be a problem ...

My decision is to use targetSdkVersion="26" in the future. ;)
 
Upvote 0
Top