Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8108377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:05:29+00:00 2026-06-06T01:05:29+00:00

I want to read the pdf file from raw folder if devices have any

  • 0

I want to read the pdf file from raw folder if devices have any pdfreader..
Here is my code:

 Intent intent = new Intent(Intent.ACTION_VIEW,
              Uri.parse("android.resource://com.powergroupbd.pdfreader/raw" + R.raw.androidtasksmwp));

    intent.setType("application/pdf");
    PackageManager pm = getPackageManager();
    List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0);
    if (activities.size() > 0) {
        startActivity(intent);
    } else {
       Toast.makeText(getApplicationContext(), "No pdfreader  found", Toast.LENGTH_LONG).show();
    }

But when i run this project it shows error.here is the logcat result:

06-21 02:05:04.408: W/dalvikvm(7763): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-21 02:05:04.418: E/AndroidRuntime(7763): FATAL EXCEPTION: main
06-21 02:05:04.418: E/AndroidRuntime(7763): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.qo.android.htcgep/com.qo.android.am.pdflib.app.RenderScreen}: java.lang.NullPointerException
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.os.Looper.loop(Looper.java:130)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.ActivityThread.main(ActivityThread.java:3683)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at java.lang.reflect.Method.invokeNative(Native Method)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at java.lang.reflect.Method.invoke(Method.java:507)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at dalvik.system.NativeStart.main(Native Method)
06-21 02:05:04.418: E/AndroidRuntime(7763): Caused by: java.lang.NullPointerException
06-21 02:05:04.418: E/AndroidRuntime(7763):  at com.qo.android.am.pdflib.app.RenderScreen.onNewIntent(Unknown Source)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at com.qo.android.am.pdflib.app.RenderScreen.onCreate(Unknown Source)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-21 02:05:04.418: E/AndroidRuntime(7763):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-21 02:05:04.418: E/AndroidRuntime(7763):  ... 11 more
06-21 02:05:04.418: W/ActivityManager(96):   Force finishing activity com.qo.android.htcgep/com.qo.android.am.pdflib.app.RenderScreen

What i am doing wrong? please help..:(

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:05:31+00:00Added an answer on June 6, 2026 at 1:05 am

    I have never tried to do it the way you do, but I use raw resources quite successfully via following procedure:

    1. Get and InputStream for resource via

      fileResourceStream =
      Activity.getResources().openRawResource(R.raw.androidclient));//R file
      references the resource id for you. In your case it will be
      R.raw.androidtasksmwp.

    2. Using this InputStream I copy (usually once the application is installed) the resource file to either device memory or SD card (decision is yours).
      Something like this can be devised:

      BufferedInputStream bIS = new BufferedInputStream(
      fileResourceStream);
      try {
              BufferedOutputStream bOS = new BufferedOutputStream(
              new FileOutputStream(Globals.applicationDirPath
                      + Globals.exeFileName, false));
      
              int BUFFER_SIZE = 4096;
              byte[] buff = new byte[BUFFER_SIZE];
              int bytesRead = bIS.read(buff, 0, BUFFER_SIZE);
              while (bytesRead >= 0) {
                  bOS.write(buff, 0, bytesRead);
                  bytesRead = bIS.read(buff, 0, BUFFER_SIZE);
              }
              bIS.close();
              bOS.flush();
              bOS.close();
      }// try {
      catch (Exception e) {
              Globals.log("Exception in checkAndCopyClientToMemory."
              + e.toString());
      }
      
    3. Open copied file in any application/for any purpose as file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read pdf file from url in the android emulator. I have
I have a pdf file with some table inside. I want to read this
I want to read text from pdf file and search text into pdf file.
In my app I want insert a pdf file for read it, the problem
basically below is the code for me to read pdf file, the output for
I want to read the PDF file using hadoop, how it is possible? I
I want to read a PDF file in android. I placed my PDF files
what i want to do is to read PDF file store on memory card
I want to extract an Image from a PDF file. I tried with the
I'm using iTextSharp to read the text from a PDF file. However, there are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.