Java Question How to implement this method in B4A Library ?

Discussion in 'Libraries developers questions' started by jahswani, Jun 17, 2015.

  1. jahswani

    jahswani Active 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.
    Code:
    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.
    Code:
    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.
     

    Attached Files:

  2. DonManfred

    DonManfred Expert Licensed User

    And this a working wrapper for it

    Please find the wrapper including an example here :D
     
    jahswani likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice