TemplateFactory

The Brady SDK TemplateFactory is the only way for a user to get a Template object.

getTemplate(InputStream template, Context context)

getTemplate returns a Template object.

  • template: an InputStream object from the user-chosen template in their local directory. (See Example below).
InputStream iStream = getResources().openRawResource(getResources().getIdentifier(selectedFileName.split("[.]")[0], "raw", getPackageName()));
  • context: a Context object that represents the UI Activity. (Example: MainActivity.this)

getTemplate(String templateName, String resFolderName, Context context)

getTemplate returns a Template object.

  • templateName: a String representing the name of a template. Can be formatted as "ExampleTemplate.BWT" OR "ExampleTemplate".

  • resFolderName: a String representing the name of the directory that the template file resides in. If "ExampleTemplate.BWT" is within a folder called "raw" inside the "res" directory, you would pass in the value "raw".

  • context: a Context object that represents the UI Activity. (Example: MainActivity.this)