<< Click to Display Table of Contents >>

Running Viewer - Android Viewer

Add OZ viewer into Eclipse project, add it to Java Build Path, create Activity Class, and create a View to show OZ viewer

Add OZ viewer into Eclipse project

Add ozrv_android.jar and android-support-v4.jar into the libs folder of the project.

Create the armeabi folder under the libs folder and add libskia_android.so and libozrv.so into the armeabi folder.

Open the Project Properties dialog box, click the Java Build Path option, the Libraries tab and the Add JARs button. And then add ozrv_android.jar and android-support-v4.jar to the JARs and class folders on the build path option.

Create script

After creating Activity, create a script to run OZ Viewer.

package com.forcs.ozreportviewer;

 

import oz.api.OZReportAPI;

import oz.api.OZReportViewer;

import android.app.Activity;

import android.os.Bundle;

import android.util.Log;

import android.widget.FrameLayout;

 

public class OZViewerActivity extends Activity

{

   OZReportViewer viewer = null;

   static

   {

       try {

           System.loadLibrary("skia_android");

           System.loadLibrary("ozrv");

       } catch (Throwable e) {

           Log.e("lib", e.getLocalizedMessage(), e);

       }

   }

 

   @Override

   public void onCreate(Bundle savedInstanceState)

   {

       super.onCreate(savedInstanceState);

 

       String params = "connection.servlet=http://127.0.0.1:8080/oz/server";

       params += "\n" + "connection.reportname=category_path/sample.ozr";

 

       FrameLayout flayout = new FrameLayout(this);

 

       viewer = OZReportAPI.createViewer(flayout, params);

 

       setContentView(flayout);

   }

 

   @Override

   public void onDestroy()

   {

       super.onDestroy();

       if(viewer != null)

       {

           viewer.dispose();

           viewer = null;

       }

   }

}

Set AndroidManifest.xml

Set AndroidManifest.xml as below:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

   package="com.forcs.ozreportviewer"

   android:versionCode="1"

   android:versionName="1.0" >

 

   <uses-sdk

       android:minSdkVersion="10"

       android:targetSdkVersion="15" />

 

   <application

       android:icon="@drawable/ic_launcher"

       android:label="@string/app_name"

       android:theme="@style/AppTheme"

       android:largeHeap="true" >

       <activity

           android:name=".OZViewerActivity"

           android:label="@string/title_activity_ozviewer"

           android:windowSoftInputMode="adjustResize"

           android:configChanges = "orientation" >

           <intent-filter>

               <action android:name="android.intent.action.MAIN" />

               <category android:name="android.intent.category.LAUNCHER" />

           </intent-filter>

       </activity>

   </application>

   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

   <uses-permission android:name="android.permission.INTERNET" />

   <uses-permission android:name="android.permission.RECORD_AUDIO" />

   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

</manifest>

Run Project

Run the project.