Android Question Get R.id of Panel control

robertogv64

Member
Licensed User
Longtime User
Greetings ... I need help with the issue of obtaining R.id from control of Panel type. I have tried with the instruction:

B4X:
int resourceId = BA.applicationContext.getResources().getIdentifier(layaut_Namex, "id", BA.packageName);

But it always returns 0, I have seen many queries on this topic in the forum but so far I have not found an effective solution.

Thanks in advance
 

robertogv64

Member
Licensed User
Longtime User
I use a biometric identification library that requires using the findViewById instruction to use the id of the panel on which the continuous video will be displayed for a face capture process, this is the code:

Java:
mFaceView = (NFaceView) activityx.findViewById(resourceId);

Is there another alternative for the identification of this resource?
 
Upvote 0

robertogv64

Member
Licensed User
Longtime User
The (NFaceView) is an acronym used by the library provider to standardize the types of data and objects for the different programming
languages under which the library works.

In this case it refers to the View object generated by the java api "findViewById"

This is the reason why I need the R.id of the Panel control in B4A
 
Upvote 0

robertogv64

Member
Licensed User
Longtime User
A question, is it possible to include xml layouts in my library created with slc?

This is an example code of a source from the library provider:
Java:
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        NCore.setContext(this);
        mFaceView = (NFaceView) findViewById(R.id.camera_view);
    .
    .
    .
    .
 
Upvote 0

robertogv64

Member
Licensed User
Longtime User
That's right, the library is being implemented following the example code that is present in the library provider's manual.

All the java library and its functions work without problems under slc B4A, but when I try to pass the view of the camera display panel I cannot do it effectively.

The java library does this process by identifying the display panel by R.id and the findViewById api, as indicated in my previous post.

I appreciate any information in this regard.
 
Upvote 0

robertogv64

Member
Licensed User
Longtime User
Thank you agraham for your attention.

This is the code in B4A that prepares the display panel to be sent to the library in slc

B4X:
                pnlCamera.Initialize("")
                
                XmlLayoutBuilder1.LoadXmlLayout(pnlCamera, "layout1")

                NeuroT.create_capture_process(XmlLayoutBuilder1.GetView("pnlCamera"))

This is the definition of layout:

B4X:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:orientation="vertical" >

    <Panel
        android:id="@+id/pnlCamera"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
    </Panel>
</LinearLayout

This is the method in the slc library that receives the invocation:

Java:
public boolean create_capture_process(BA ba, android.view.View videox){   

        mFaceView = (NFaceView)  videox;   

        .

        .

The slc library always receives a null value.

As I mentioned in a previous post the type (NFaceView) is an acronym of the library provider for the type android.view.View

It is the first time that I pass View objects from B4A to java, I appreciate any comments and suggestions
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Firstly I would abandon the use of XmlBuilder. It is old and predates the more capable current versions of the B4A Designer. I would build the layouts by code or in the Designer.

Secondly, what kind of View is the biometric library expecting? What does it do with this view? An Android View is a primitive type upon which more complex views are built. A B4A Panel is actually a ViewGroup, although it inherits from View, and may not be what you actually want to pass.
 
Upvote 0
Top