Android Question [SOLVED] invalid value for field?

sorex

Expert
Licensed User
Longtime User
Does anyone know what this error means and what could cause it?

line 96 is the Sub Activity_Create(FirstTime As Boolean) of the main module
and it doesn't seem to execute it at all.

B4X:
** Activity (main) Create, isFirst = true **
Error occurred on line: 96 (Main)
java.lang.IllegalArgumentException: invalid value for field
   at java.lang.reflect.Field.setField(Native Method)
   at java.lang.reflect.Field.set(Field.java:585)
   at anywheresoftware.b4a.shell.Shell.setStateBeforeUserSub(Shell.java:491)
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:400)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
 

sorex

Expert
Licensed User
Longtime User
the culprit seems to be on the last line below.

doesn't make much sens as running it a second time always works fine.
clearing the project and running it again create the error again unless I comment that line.

B4X:
Private audioBoost As Int
Private audioBoostImages(2) As String=Array("audio_volume_low.png","audio_volume_high.png")
Private ivBoost As ImageView

audioBoost=StateManager.GetSetting2("AudioBoost",0)
Log("audioboost:"& audioBoost)
ivBoost.Bitmap=LoadBitmap(File.DirAssets,audioBoostImages(audioBoost))
 
Last edited:
Upvote 0

sorex

Expert
Licensed User
Longtime User
ok, it seems that my array declaration missed something but the compiler didn't trigger this.

B4X:
Private audioBoostImages(2) As String=Array("audio_volume_low.png","audio_volume_high.png")

'should be

Private audioBoostImages(2) As String=Array As String("audio_volume_low.png","audio_volume_high.png")
 
Upvote 0
Top