I am using below code in my class.
package com.radaee.reader;
import java.io.File;
import com.radaee.pdf.Document;
import com.radaee.pdf.Global;
import com.radaee.pdf.Page.Annotation;
import com.radaee.reader.PDFReader.PDFReaderListener;
import com.radaee.util.PDFThumbView;
import com.radaee.view.PDFVPage;
import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.RelativeLayout;
public class MainActivity extends Activity implements PDFReaderListener {
private RelativeLayout m_layout;
private RelativeLayout mContentView;
private PDFReader m_reader = null;
private PDFThumbView m_thumb = null;
private Document doc;
private Document m_doc = new Document();
// public final static String PATH_SD_CARD = "/20141017/Prime/pdf_previews";
File sdDir = Environment.getExternalStorageDirectory();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
try {
Global.Init(this);
m_layout = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.reader, null);
m_reader = (PDFReader) m_layout.findViewById(R.id.view);
// m_doc.SetCache(sdDir.toString() + "/1.dat");
// m_doc.
// m_reader.PDFOpen(doc, false, this);
// m_thumb = (PDFThumbView) m_layout.findViewById(R.id.thumbs);
// setContentView(m_layout);
openDoc("/mnt/sdcard/pdf/1.pdf");
} catch (Exception e) {
e.printStackTrace();
}
}
public void openDoc(String path) {
m_doc.Close();
int ret = m_doc.Open(path, null);
if (ret == 0) {
// m_doc.SetCache( Global.tmp_path + "/temp.dat" );
m_reader.PDFOpen(m_doc, false, this);
mContentView.removeAllViews();
mContentView.addView(m_layout);
}
}
protected void onDestroy() {
// m_vFiles.close();
/*
* if( m_vFiles != null ) { m_vFiles.close(); m_vFiles = null; }
*/
if (m_thumb != null) {
m_thumb.thumbClose();
m_thumb = null;
}
if (m_reader != null)
m_reader.PDFClose();
if (m_doc != null)
m_doc.Close();
Global.RemoveTmp();
super.onDestroy();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void OnPageModified(int pageno) {
// TODO Auto-generated method stub
}
@Override
public void OnPageChanged(int pageno) {
// TODO Auto-generated method stub
}
@Override
public void OnAnnotClicked(PDFVPage vpage, Annotation annot) {
// TODO Auto-generated method stub
}
@Override
public void OnSelectEnd(String text) {
// TODO Auto-generated method stub
}
@Override
public void OnOpenURI(String uri) {
// TODO Auto-generated method stub
}
@Override
public void OnOpenJS(String js) {
// TODO Auto-generated method stub
}
@Override
public void OnOpenMovie(String path) {
// TODO Auto-generated method stub
}
@Override
public void OnOpenSound(int[] paras, String path) {
// TODO Auto-generated method stub
}
@Override
public void OnOpenAttachment(String path) {
// TODO Auto-generated method stub
}
@Override
public void OnOpen3D(String path) {
// TODO Auto-generated method stub
}
}
when i run this i get below exception
10-28 13:44:39.790: A/libc(7264): Fatal signal 4 (SIGILL) at 0x5baa0fe2 (code=1)
I debug and the found below lines give me that error.
Global.Init(this);
If i comment the Init method it gives me below error.
10-28 14:40:33.831: W/dalvikvm(4390): No implementation found for native Lcom/radaee/pdf/Document;.open:(Ljava/lang/String;Ljava/lang/String;)I
10-28 14:40:33.831: D/AndroidRuntime(4390): Shutting down VM
10-28 14:40:33.831: W/dalvikvm(4390): threadid=1: thread exiting with uncaught exception (group=0x4184cda0)
10-28 14:40:33.831: E/AndroidRuntime(4390): FATAL EXCEPTION: main
10-28 14:40:33.831: E/AndroidRuntime(4390): Process: com.radaee.reader, PID: 4390
10-28 14:40:33.831: E/AndroidRuntime(4390): java.lang.UnsatisfiedLinkError: Native method not found: com.radaee.pdf.Document.open:(Ljava/lang/String;Ljava/lang/String;)I
10-28 14:40:33.831: E/AndroidRuntime(4390): at com.radaee.pdf.Document.open(Native Method)
10-28 14:40:33.831: E/AndroidRuntime(4390): at com.radaee.pdf.Document.Open(Document.java:417)
10-28 14:40:33.831: E/AndroidRuntime(4390): at com.radaee.reader.MainActivity.openDoc(MainActivity.java:58)
10-28 14:40:33.831: E/AndroidRuntime(4390): at com.radaee.reader.MainActivity.onCreate(MainActivity.java:46)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.Activity.performCreate(Activity.java:5600)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2504)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2599)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.ActivityThread.access$900(ActivityThread.java:174)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.os.Handler.dispatchMessage(Handler.java:102)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.os.Looper.loop(Looper.java:146)
10-28 14:40:33.831: E/AndroidRuntime(4390): at android.app.ActivityThread.main(ActivityThread.java:5748)
10-28 14:40:33.831: E/AndroidRuntime(4390): at java.lang.reflect.Method.invokeNative(Native Method)
10-28 14:40:33.831: E/AndroidRuntime(4390): at java.lang.reflect.Method.invoke(Method.java:515)
10-28 14:40:33.831: E/AndroidRuntime(4390): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
10-28 14:40:33.831: E/AndroidRuntime(4390): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
10-28 14:40:33.831: E/AndroidRuntime(4390): at dalvik.system.NativeStart.main(Native Method)