Java Question How "Emulate" an XML ResourceId?


Licensed User
I´m doing a new wrap for OSMDroid.
The Osmdroids Infowindow can be initiated using an int which is the ResourceID from a XML layout.
We don´t have access to anything other than using this id.

As a reference here the code from the Library
package org.osmdroid.views.overlay.infowindow;

import org.osmdroid.api.IMapView;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.Marker;
import org.osmdroid.views.overlay.infowindow.BasicInfoWindow;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;

* {@link org.osmdroid.views.overlay.infowindow.MarkerInfoWindow} is the default
* implementation of {@link org.osmdroid.views.overlay.infowindow.InfoWindow} for a
* {@link org.osmdroid.views.overlay.Marker}.
* It handles
*          = {@link org.osmdroid.views.overlay.OverlayWithIW#getTitle()},
* = {@link org.osmdroid.views.overlay.OverlayWithIW#getSubDescription()},
*    = {@link org.osmdroid.views.overlay.OverlayWithIW#getSnippet()},
*          = {@link org.osmdroid.views.overlay.Marker#getImage()}
* Description and sub-description interpret HTML tags (in the limits of the Html.fromHtml(String) API).
* Clicking on the bubble will close it.
* <img alt="Class diagram around Marker class" width="686" height="413" src='./doc-files/marker-infowindow-classes.png' />
* [USER=12625]@author[/USER] M.Kergall
public class MarkerInfoWindow extends BasicInfoWindow {

    protected Marker mMarkerRef; //reference to the Marker on which it is opened. Null if none.
     * @param layoutResId layout that must contain these ids: bubble_title,bubble_description,
     *                       bubble_subdescription, bubble_image
     * @param mapView
    public MarkerInfoWindow(int layoutResId, MapView mapView) {
        super(layoutResId, mapView);
        //mMarkerRef = null;

     * reference to the Marker on which it is opened. Null if none.
     * @return
    public Marker getMarkerReference(){
        return mMarkerRef;
    [USER=69643]@override[/USER] public void onOpen(Object item) {
        mMarkerRef = (Marker)item;
        if (mView==null) {
            Log.w(IMapView.LOGTAG, "Error trapped,, mView is null!");
        //handle image
        ImageView imageView = (ImageView)mView.findViewById(mImageId /**/);
        Drawable image = mMarkerRef.getImage();
        if (image != null){
            imageView.setImageDrawable(image); //or setBackgroundDrawable(image)?
        } else

    [USER=69643]@override[/USER] public void onClose() {
        mMarkerRef = null;
        //by default, do nothing else
Can we emulate this layoutResId from B4A in any way? Or from within the wrapper?

Alternative would be that we need to use XML layouts for the Markerwindows. I fear that B4A will not create any entry in the R File for Additional Resources added using the additionalres: ../Foldername keyword.

Using the XML Layoutbuilder does not help as it does not return any layoutResId for a loaded Layout.

Also i fear the Ids for

are also not set in the R file when using the XML Layoutbuilder as the R file content is generated at Compiletime.