Java Question RAF in library

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hey,

I keep having nullpointer when trying to use the RandomAccessFile library in my library.

B4X:
RandomAccessFile raf = new RandomAccessFile();
      Map mp = new Map();
      mp.Initialize();
      mp.Put("id", id);
      File extStore = Environment.getExternalStorageDirectory();
      try {
         raf.Initialize(extStore.getAbsolutePath(), "Layout.frame", false);
      } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      
      try {
         raf.WriteObject(mp, true, raf.CurrentPosition);
         
      } catch (IllegalArgumentException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (IllegalAccessException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }

I'm just trying to write a map with 1 key and value in it.


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = true **


** Activity (main) Create, isFirst = true **


BroadcastReceiver has been initialized.


** Activity (main) Resume **


View attached!


java.lang.RuntimeException: Unable to start service com.rootsoft.standout.MostBasicWindow@41124b70 with Intent { act=SHOW cmp=com.rootsoft.standout/.MostBasicWindow (has extras) }: java.lang.NullPointerException


at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2376)
at android.app.ActivityThread.access$1900(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.WriteInt(RandomAccessFile.java:221)


at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.writeHelper(RandomAccessFile.java:324)
at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.WriteObject(RandomAccessFile.java:303)
at com.rootsoft.standout.MostBasicWindow.createAndAttachView(MostBasicWindow.java:73)
at com.rootsoft.standout.StandOutWindow$Window.<init>(StandOutWindow.java:2213)
at com.rootsoft.standout.StandOutWindow.show(StandOutWindow.java:1416)
at com.rootsoft.standout.StandOutWindow.onStartCommand(StandOutWindow.java:716)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
... 10 more

Error happens on writeobject
 
Last edited:

XverhelstX

Well-Known Member
Licensed User
Longtime User
and also reading doesn't seem to work:

B4X:
@Override
   protected void createAndAttachView(int id, FrameLayout frame) {
      
      //Grab the panel for the view.
      RandomAccessFile raf = new RandomAccessFile();
      Map mp = new Map();
      mp.Initialize();
      try {
         raf.Initialize(File.getDirDefaultExternal(), "Layout.frame", false);
      } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      
      try {
         mp = (Map) raf.ReadObject(raf.CurrentPosition);
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
         Log.i("B4A", e.getMessage());
      }
      
      PanelWrapper pnl = (PanelWrapper) mp.Get("FrameLayout");
      
      //Add the view
      frame.addView(pnl.getObject());
      
      //Broadcast an intent to the user.
      intent = new IntentWrapper();
      intent.Initialize("createAndAttachView", "");
      intent.PutExtra("id", id);
      intent.PutExtra("message", "View Attached");
      BA.applicationContext.sendBroadcast(intent.getObject());
      
      //Log - debugging
      Log.i("B4A", "View attached!");
   }

** Activity (main) Create, isFirst = true **


BroadcastReceiver has been initialized.


** Activity (main) Resume **
java.lang.RuntimeException: Unable to start service com.rootsoft.standout.MostBasicWindow@411333d8 with Intent { act=SHOW cmp=com.rootsoft.standout/.MostBasicWindow (has extras) }: java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map$MyMap cannot be cast to anywheresoftware.b4a.objects.collections.Map


at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2376)
at android.app.ActivityThread.access$1900(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)


Caused by: java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map$MyMap cannot be cast to anywheresoftware.b4a.objects.collections.Map
at com.rootsoft.standout.MostBasicWindow.createAndAttachView(MostBasicWindow.java:67) -- this is readObject
at com.rootsoft.standout.StandOutWindow$Window.<init>(StandOutWindow.java:2213)
at com.rootsoft.standout.StandOutWindow.show(StandOutWindow.java:1416)
at com.rootsoft.standout.StandOutWindow.onStartCommand(StandOutWindow.java:716)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
... 10 more

I'm using B4A to write a map and Java library to retrieve a panel from the map.
B4X:
'Create a map
   Dim mapLayout As Map
   mapLayout.Initialize
   mapLayout.Put("FrameLayout", pnlBasic)
   mapLayout.Put("Message", "Sparta")
   
   Dim raf As RandomAccessFile
   raf.Initialize(File.DirDefaultExternal, "layout.frame", False)
   Log("Position: " & raf.CurrentPosition)
   raf.WriteObject(mapLayout, True, raf.CurrentPosition)
   Log("Position: " & raf.CurrentPosition)
   raf.Close
   
   mapLayout.Clear
 
Last edited:

XverhelstX

Well-Known Member
Licensed User
Longtime User
Because that seems the only possible way for me. I'm unable to raise events from my library because i can't initialize a ba instance. Im trying a different approach now, and do you know what is wrong with the readobject method? Is there any other way i can pass a view to add to the framelayout?

Tomas

Sent from my SE Xperia Play using Tapatalk.
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
1. Is it possible to tell me which problems?

2. Also passing the ba instance in a public method, I don't know how I would achieve this with the StandOut library.

I have 2 classes:
StandOutDemo and MostBasicWindow
In StandOutDemo, i call this:
B4X:
/**
    * Shows the most Basic Window.
    */
   public void showBasicWindow() {
      StandOutWindow.show(ba.context, MostBasicWindow.class, StandOutWindow.DEFAULT_ID);
   }

This code will call the MostBasicWindow. I cannot pass a MostBasicWindow instance to it, it's the class, so i'm unable to call an Initialize method. Perhaps there's a way i can grab the window that was started.

3. Could you please read the topic i started here. android - Solve NotSerializableException - Stack Overflow

As for getting rid of your exception, you just have to implement the Serializable interface in your class in question (in your case anywheresoftware.b4a.BALayout).

This means that I need an update in B4AShared.jar in BALayout.
I'm wondering if you could send me an updated version of it.

Thanks
Tomas


EDIT: INFORMATION FOR TDS




  • Methods:
    • isSet (flags As Int, flag As Int) As Boolean

  • Properties:
    • DirDefaultExternal As String
    Methods:
    • getResourceId (pResourceName As String, pResourceType As String) As Int
  • RSEditor
    Properties:
    • Editor As Editor
      Gets or sets the editor.
    Methods:
    • Initialize ()
      Initializes the Editor
      EventName - Events subs prefix.
      Convenient way to resize or reposition a Window. The Editor allows you to easily resize and reposition the window around anchor points.
    • commit
      Commit the changes to this window. Updates the layout.
      This Editor cannot be used after you commit.
    • setAnchorPoint (x As Float, y As Float)
      Sets the AnchorPoint
    • setPosition (x As Int, y As Int)
      Set the position of this window in absolute pixels
    • setSize (width As Int, height As Int)
      Set the size of this window in absolute pixels.
  • RSFlags
  • RSMostBasicWindow
    Properties:
    • Application As Application
    • ApplicationContext As Context
    • ApplicationInfo As ApplicationInfo
    • Assets As AssetManager
    • BaseContext As Context
    • CacheDir As File
    • ClassLoader As ClassLoader
    • ContentResolver As ContentResolver
    • ExternalCacheDir As File
    • FilesDir As File
    • MainLooper As Looper
    • ObbDir As File
    • PackageCodePath As String
    • PackageManager As PackageManager
    • PackageName As String
    • PackageResourcePath As String
    • Resources As Resources
    • Theme As Theme
    • Wallpaper As Drawable
    • WallpaperDesiredMinimumHeight As Int
    • WallpaperDesiredMinimumWidth As Int
    Methods:
    • bindService (arg0 As Intent, arg1 As ServiceConnection, arg2 As Int) As Boolean
    • checkCallingOrSelfPermission (arg0 As String) As Int
    • checkCallingOrSelfUriPermission (arg0 As Uri, arg1 As Int) As Int
    • checkCallingPermission (arg0 As String) As Int
    • checkCallingUriPermission (arg0 As Uri, arg1 As Int) As Int
    • checkPermission (arg0 As String, arg1 As Int, arg2 As Int) As Int
    • checkUriPermission (arg0 As Uri, arg1 As Int, arg2 As Int, arg3 As Int) As Int
    • clearWallpaper
    • close (context As Context, cls As Class, id As Int)
      Close an existing window with an existing id.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that is managing
      the window.
      id: The id representing this window. The window must previously be
      shown.
    • closeAll (context As Context, cls As Class)
      Close all existing windows.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that is managing
      the window.
    • createPackageContext (arg0 As String, arg1 As Int) As Context
    • databaseList As String()
    • deleteDatabase (arg0 As String) As Boolean
    • deleteFile (arg0 As String) As Boolean
    • enforceCallingOrSelfPermission (arg0 As String, arg1 As String)
    • enforceCallingOrSelfUriPermission (arg0 As Uri, arg1 As Int, arg2 As String)
    • enforceCallingPermission (arg0 As String, arg1 As String)
    • enforceCallingUriPermission (arg0 As Uri, arg1 As Int, arg2 As String)
    • enforcePermission (arg0 As String, arg1 As Int, arg2 As Int, arg3 As String)
    • enforceUriPermission (arg0 As Uri, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As String)
    • fileList As String()
    • getCloseAllIntent (context As Context, cls As Class) As Intent
      See {@link #closeAll(Context, Class, int)}.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that is managing
      the window.
      Return type: @return:An {@link Intent} to use with
      {@link Context#startService(Intent)}.
    • getCloseIntent (context As Context, cls As Class, id As Int) As Intent
      See {@link #close(Context, Class, int)}.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that is managing
      the window.
      id: The id representing this window. If the id exists, and the
      corresponding window was previously hidden, then that window
      will be restored.
      Return type: @return:An {@link Intent} to use with
      {@link Context#startService(Intent)}.
    • getDatabasePath (arg0 As String) As File
    • getDir (arg0 As String, arg1 As Int) As File
    • getExternalFilesDir (arg0 As String) As File
    • getFileStreamPath (arg0 As String) As File
    • getHideIntent (context As Context, cls As Class, id As Int) As Intent
      See {@link #hide(Context, Class, int)}.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that is managing
      the window.
      id: The id representing this window. If the id exists, and the
      corresponding window was previously hidden, then that window
      will be restored.
      Return type: @return:An {@link Intent} to use with
      {@link Context#startService(Intent)}.
    • getSendDataIntent (context As Context, toCls As Class, toId As Int, requestCode As Int, data As Bundle, fromCls As Class, fromId As Int) As Intent
      See {@link #sendData(Context, Class, int, int, Bundle, Class, int)}.
      context: A Context of the application package implementing the class of
      the sending window.
      toCls: The Service's class extending {@link StandOutWindow} that is
      managing the receiving window.
      toId: The id of the receiving window.
      requestCode: Provide a request code to declare what kind of data is being
      sent.
      data: A bundle of parceleable data to be sent to the receiving
      window.
      fromCls: If the sending window wants a result, provide the class of the
      sending window.
      fromId: If the sending window wants a result, provide the id of the
      sending window.
      Return type: @return:An {@link Intnet} to use with
      {@link Context#startService(Intent)}.
    • getSharedPreferences (arg0 As String, arg1 As Int) As SharedPreferences
    • getShowIntent (context As Context, cls As Class, id As Int) As Intent
      See {@link #show(Context, Class, int)}.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that will be used
      to create and manage the window.
      id: The id representing this window. If the id exists, and the
      corresponding window was previously hidden, then that window
      will be restored.
      Return type: @return:An {@link Intent} to use with
      {@link Context#startService(Intent)}.
    • getStandOutWindow (id As Int, cls As Class) As Window
      Returns the StandOut Window with the given id.
      id:
      Return type: @return:
    • getString (arg0 As Int) As String
    • getSystemService (arg0 As String) As Object
    • getText (arg0 As Int) As CharSequence
    • grantUriPermission (arg0 As String, arg1 As Uri, arg2 As Int)
    • hide (context As Context, cls As Class, id As Int)
      Hide the existing window corresponding to the id. To enable the ability
      to restore this window, make sure you implement
      {@link #getHiddenNotification(int)}.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that is managing
      the window.
      id: The id representing this window. The window must previously be
      shown.
    • isRestricted As Boolean
    • obtainStyledAttributes (arg0 As Int()) As TypedArray
    • onBind (intent As Intent) As IBinder
    • onConfigurationChanged (arg0 As Configuration)
    • onCreate
    • onDestroy
    • onLowMemory
    • onRebind (arg0 As Intent)
    • onStart (arg0 As Intent, arg1 As Int)
    • onStartCommand (intent As Intent, flags As Int, startId As Int) As Int
    • onTaskRemoved (arg0 As Intent)
    • onTrimMemory (arg0 As Int)
    • onUnbind (arg0 As Intent) As Boolean
    • openFileInput (arg0 As String) As FileInputStream
    • openFileOutput (arg0 As String, arg1 As Int) As FileOutputStream
    • openOrCreateDatabase (arg0 As String, arg1 As Int, arg2 As CursorFactory) As SQLiteDatabase
    • peekWallpaper As Drawable
    • registerComponentCallbacks (arg0 As ComponentCallbacks)
    • registerReceiver (arg0 As BroadcastReceiver, arg1 As IntentFilter) As Intent
    • removeStickyBroadcast (arg0 As Intent)
    • revokeUriPermission (arg0 As Uri, arg1 As Int)
    • sendBroadcast (arg0 As Intent)
    • sendData (context As Context, toCls As Class, toId As Int, requestCode As Int, data As Bundle, fromCls As Class, fromId As Int)
      This allows windows of different applications to communicate with each
      other.

      <p>
      Send {@link Parceleable} data in a {@link Bundle} to a new or existing
      windows. The implementation of the recipient window can handle what to do
      with the data. To receive a result, provide the class and id of the
      sender.
      context: A Context of the application package implementing the class of
      the sending window.
      toCls: The Service's class extending {@link StandOutWindow} that is
      managing the receiving window.
      toId: The id of the receiving window, or DISREGARD_ID.
      requestCode: Provide a request code to declare what kind of data is being
      sent.
      data: A bundle of parceleable data to be sent to the receiving
      window.
      fromCls: Provide the class of the sending window if you want a result.
      fromId: Provide the id of the sending window if you want a result.
    • sendOrderedBroadcast (arg0 As Intent, arg1 As String)
    • sendStickyBroadcast (arg0 As Intent)
    • sendStickyOrderedBroadcast (arg0 As Intent, arg1 As BroadcastReceiver, arg2 As Handler, arg3 As Int, arg4 As String, arg5 As Bundle)
    • show (context As Context, cls As Class, id As Int)
      Show a new window corresponding to the id, or restore a previously hidden
      window.
      context: A Context of the application package implementing this class.
      cls: The Service extending {@link StandOutWindow} that will be used
      to create and manage the window.
      id: The id representing this window. If the id exists, and the
      corresponding window was previously hidden, then that window
      will be restored.
    • startActivities (arg0 As Intent())
    • startActivity (arg0 As Intent)
    • startForeground (arg0 As Int, arg1 As Notification)
    • startInstrumentation (arg0 As ComponentName, arg1 As String, arg2 As Bundle) As Boolean
    • startIntentSender (arg0 As IntentSender, arg1 As Intent, arg2 As Int, arg3 As Int, arg4 As Int)
    • startService (arg0 As Intent) As ComponentName
    • stopForeground (arg0 As Boolean)
    • stopSelf
    • stopSelfResult (arg0 As Int) As Boolean
    • stopService (arg0 As Intent) As Boolean
    • unbindService (arg0 As ServiceConnection)
    • unregisterComponentCallbacks (arg0 As ComponentCallbacks)
    • unregisterReceiver (arg0 As BroadcastReceiver)
  • RSStandOut
    Permissions:
    • android.permission.READ_PHONE_STATE
    • android.permission.WRITE_EXTERNAL_STORAGE
    • android.permission.WRITE_SECURE_SETTINGS
    • android.permission.SYSTEM_ALERT_WINDOW
    Methods:
    • HideWindow (id As Int)
      Hides this window with the given id.
      id:
    • Initialize ()
      Initializes the StandOut library.
      EventName - Events subs prefix.
    • ReadObjectFromMemory (Dir As String, filename As String) As Object
      Reads an object from a specific file.
      Dir:
      filename:
      Return type: @return:
    • WindowParams (id As Int, AppName As String, Left As Integer, Top As Int, Width As Int, Height As Int) As Boolean
      Sets the window parameters of the window.
      Left:
      Top:
      Width:
      Height:
      Return type: @return:
    • WriteObjectToMemory (Dir As String, filename As String, object As Object) As Boolean
      Writes and object to the specific file.
      Dir:
      filename:
      object:
    • closeWindow (id As Int)
      Closes the window with the given id.
    • closeWindowAll
      Closes all windows.
    • getStandOutWindow (id As Int) As Window
      Get the standout window with the given id.
      id:
      Return type: @return:
    • setFlags (id As Int, map As Map) As Boolean
      Sets the flags for the given window.
    • setNotificationInfo (id As Int, AppIcon As Int, PersistentTitle As String, PersistentMessage As String, HiddenTitle As String, HiddenMessage As String) As Boolean
      Set the titles and messages for the notifications.
    • showWindow (id As Int)
      Shows the window with the given id.
  • RSWindow
    Properties:
    • Background As Drawable
      Gets or sets the background.
    • Clickable As Boolean
      Gets or sets the view to be clickable.
    • Color As
      Sets the background color.
    • Enabled As Boolean
      Gets or sets the window enabled.
    • FrameLayout As FrameLayout
      Gets the framelayout.
    • Height As Int
      Gets the height of the window.
    • Left As Int
      Gets the window's left.
    • MinimumHeight As
      Sets the window's minimum height.
    • MinimumWidth As
      Sets the window's minimum width.
    • NumberOfViews As Int
      Gets the number of views.
    • Tag As Object
      Gets or sets a tag to the window.
    • Top As Int
      Gets the window's top.
    • UniqueID As Int
      Returns an unique id.
    • Visible As
      Gets or sets the window visibility.
    • Width As Int
      Gets the width of the window.
    • Window As Window
      Gets or sets the window.
    Methods:
    • AddView (child As View, left As Int, top As Int, width As Int, height As Int)
      Adds a view to the window.
    • BringToFront
      Brings the window to the front.
    • Edit As Editor
      Edits the position of the window.
      Return type: @return:
    • GetView (index As Int) As View
      Gets a view by it's id.
    • Initialize (EventName As String)
      Initializes the Window.
      EventName - Events subs prefix.
    • Invalidate
      Invalidates the view forcing to redraw itself.
    • RemoveAllViews
      Removes all the views
    • RemoveView
      Removes the view.
      You should not call this.
    • RemoveViewAt (index As Int)
      Removes the view at the given position.
    • RequestFocus As Boolean
      Request the window to be focused.
    • isFocusable As Boolean
      Is the window focusable?
    • isFocused As Boolean
      Is the window focused?
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
What I meant to say that I can help you with writing Basic4android code. I can somewhat help with building libraries. However I do not have the time to delve into libraries code and find the problems.

You can add a BA parameter to showBasic4Window:
B4X:
public void showBasicWindows(BA ba) {
}

I'm wondering if you could send me an updated version of it.
Sorry but I can't.
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
What I meant to say that I can help you with writing Basic4android code. I can somewhat help with building libraries. However I do not have the time to delve into libraries code and find the problems.

You can add a BA parameter to showBasic4Window:
B4X:
public void showBasicWindows(BA ba) {
}


Sorry but I can't.

Okay, but how would i pass it to the MostBasicWindow?
That's the main issue we are facing. (That's why we are trying to find different solutions like raf, intents, etc to pass the data) Cause we want to raise an event with the framelayout and id.

If i'm able to pass the ba instance to the MostBasicWindow, i think we can solve the problem them.

I understand you can't delve in the libraries, but libraries are a thing that gives Basic4Android a boost. Personally i don't think Basic4Android would be far without the libraries.
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Last edited:

XverhelstX

Well-Known Member
Licensed User
Longtime User
And apparently, i can also seem to use GSON:
java - Need to make third party objects serializable without writing wrapper - Stack Overflow

If i'm trying to put a ba instance to it, but it gives me the following error:

** Activity (main) Create, isFirst = true **


BroadcastReceiver has been initialized.


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (main) Resume **


0. map created.


StandOutDemoshowBasicWindow (java line: 61)





java.lang.IllegalArgumentException: class android.text.BoringLayout declares multiple JSON fields named mPaint
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:122)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)


at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
at com.google.gson.Gson.getAdapter(Gson.java:353)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:209)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:146)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:89)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:195)
at com.goo
java.lang.IllegalArgumentException: class android.text.BoringLayout declares multiple JSON fields named mPaint
** Activity (main) Pause, UserClosed = false **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **

Any help on how i could solve this?

Tomas

Edit:

Or another possible way to fix this is by using a constructor for MostBasicWindow, passing ba instance, which gives me the following error while compiling:

Compiling code. 0.01
Compiling layouts code. 0.01
Generating R file. 0.00
Compiling generated Java code. Error
B4A line: 13
Dim mbw As RSMostBasicWindow
javac 1.6.0_21
src\com\rootsoft\standout\main.java:298: cannot find symbol
symbol : constructor MostBasicWindow()
location: class com.rootsoft.standout.MostBasicWindow
mostCurrent._mbw = new com.rootsoft.standout.MostBasicWindow();
^
1 error
 
Last edited:

XverhelstX

Well-Known Member
Licensed User
Longtime User
I don't get it.
How would i pass the instance to the constructor if i don't have access to the MostBasicWindow instance?

B4X:
/**
    * Shows the most Basic Window.
    */
   public void showBasicWindow() {
      StandOutWindow.show(ba.context, MostBasicWindow.class, StandOutWindow.DEFAULT_ID);
   }

will show a MostBasicWindow. The MostBasicWindow class is a class that I cannot instantiate because the show parameters passes the class and not the instance.

For example i can't do this:
B4X:
/**
    * Shows the most Basic Window.
    */
   public void showBasicWindow(MostBasicWindow mbw) {
      StandOutWindow.show(ba.context, mbw, StandOutWindow.DEFAULT_ID);
   }

B4X:
Dim mbw as mostbasicwindow
mbw.initialize("Eventname")
Standout.show(mbw)

This is not possible as the library only handles the class.
So I CANNOT call Initialize to create a BA instance
 
Top