申请许可证

加载许可证文件

Aspose.Cells for Android via Java,license可以作为资源嵌入,或从流中加载:

  1. 把license文件放在任意位置**/mnt/SD卡/**.
  2. 创建引用文件的流。
  3. 将流(包含许可证文件)传递到 SetLicense 方法中。

Java

 String dataDir = Environment.getExternalStorageDirectory().getPath() + "/";

// Create a stream object containing the license file

FileInputStream fstream = new FileInputStream(dataDir + "Aspose.Cells.Android.lic");

// Instantiate the License class

License license = new License();

//Set the license through the stream object

license.setLicense(fstream);

从嵌入式资源应用许可证

要从 Android 包文件中按名称访问作为资源的许可证:

  1. 将许可证文件作为资源添加到您的应用程序的资源/原始文件夹。 许可证文件应该在资源/原始文件夹。
  2. 使用以下代码示例从资源访问/加载许可证。

Java

 License license = new License();

InputStream inputStream = getResources().openRawResource(R.raw.license);

license.setLicense(inputStream);