Java Question How to implement this method in B4A Library ?

jahswant

Well-Known Member
Licensed User
I want to understand i'am trying a Wrapper but i'm stuck here.This is the method i want to implement in my B4A project.
B4X:
    public void setLicenses(int id) throws NotFoundException,
            XmlPullParserException, IOException {
        List<License> licenses = ParseLicenseXml.Parse(getResources()
                .getXml(id));
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View child;
        TextView title;
        TextView name;
        TextView license;

        for (License l : licenses) {
            child = inflater.inflate(R.layout.license_layout, null);
            title = (TextView) child.findViewById(R.id.license_title);
            name = (TextView) child.findViewById(R.id.license_name);
            license = (TextView) child.findViewById(R.id.license_license);

            title.setText(getContext().getResources().getString(
                    l.getType() == License.TYPE_FILE ? R.string.file
                            : R.string.software));
            name.setText(getContext().getResources().getString(R.string.bullet)
                    + l.getName());
            license.setText(l.getLicense());
            mContainer.addView(child);
        }
This is the usage.I want to load the file on my view.
B4X:
LicenseView licenseView = (LicenseView) findViewById(R.id.licenseView1);
try {
    licenseView.setLicenses(R.xml.licenses);
} catch (NotFoundException e1) {
} catch (XmlPullParserException e1) {
} catch (IOException e1) {
}
This is the original github project. https://github.com/LarsWerkman/LicenseView
Thanks for your help.
I attached what what i've already done.
 

Attachments

Top