reading pdf within the android app
<p>I am making an application which require to open pdf within the android app without using any third party application.also i don't want to view my pdf in webview .For this i use PdfViewer.jar  and made a code like below.</p>

<p>java :</p>

<pre><code>    public class MainActivity extends ListActivity{

        public class First extends ListActivity {

            String[] pdflist;
            File[] imagelist;
            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                //setContentView(R.layout.main);

                File images = Environment.getExternalStorageDirectory();
                imagelist = images.listFiles(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        return ((name.endsWith(".pdf")));
                    }
                });
                pdflist = new String[imagelist.length];
                for (int i = 0; i &lt; imagelist.length; i++) {
                    pdflist[i] = imagelist[i].getName();
                }
                this.setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                        android.R.layout.simple_list_item_1, pdflist));
            }

            protected void onListItemClick(ListView l, View v, int position, long id) {
                super.onListItemClick(l, v, position, id);
                String path = imagelist[(int) id].getAbsolutePath();
                openPdfIntent(path);
            }

            private void openPdfIntent(String path) {
                try {
                    final Intent intent = new Intent(First.this, Second.class);
                    intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
                    startActivity(intent);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }}

Second.java



public class Second extends PdfViewerActivity 
{

@Override
public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
}

public int getPreviousPageImageResource() {
    return R.drawable.left_arrow;
}

public int getNextPageImageResource() {
    return R.drawable.right_arrow;
}

public int getZoomInImageResource() {
    return R.drawable.zoom_in;
}

public int getZoomOutImageResource() {
    return R.drawable.zoom_out;
}

public int getPdfPasswordLayoutResource() {
    return R.layout.pdf_file_password;
}

public int getPdfPageNumberResource() {
    return R.layout.dialog_pagenumber;
}

public int getPdfPasswordEditField() {
    return R.id.etPassword;
}

public int getPdfPasswordOkButton() {
    return R.id.btOK;
}

public int getPdfPasswordExitButton() {
    return R.id.btExit;
}

public int getPdfPageNumberEditField() {
    return R.id.pagenum_edit;
}
}
</code></pre>

<p>i have added my second.java in android menifest too.But my logcat is showing the following error.M not getting the error</p>

<p>logcat :</p>

<pre><code>02-12 09:23:50.408: E/ActivityThread(713): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d8b368 that was originally bound here
02-12 09:23:50.408: E/ActivityThread(713):  at android.app.LoadedApk$ServiceDispatcher.&lt;init&gt;(LoadedApk.java:969)
02-12 09:23:50.408: E/ActivityThread(713):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-12 09:23:50.408: E/ActivityThread(713):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-12 09:23:50.408: E/ActivityThread(713):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-12 09:23:50.408: E/ActivityThread(713):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-12 09:23:50.408: E/ActivityThread(713):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-12 09:23:50.408: E/ActivityThread(713):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-12 09:23:50.408: E/ActivityThread(713):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
02-12 09:23:50.408: E/ActivityThread(713):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
02-12 09:23:50.408: E/ActivityThread(713):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-12 09:23:50.408: E/ActivityThread(713):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-12 09:23:50.408: E/ActivityThread(713):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-12 09:23:50.408: E/ActivityThread(713):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-12 09:23:50.408: E/ActivityThread(713):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-12 09:23:50.408: E/ActivityThread(713):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-12 09:23:50.408: E/ActivityThread(713):  at java.lang.Thread.run(Thread.java:856)
02-12 09:23:50.455: E/StrictMode(713): null
</code></pre>

<p>Any hepl??</p>
