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 8074993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:50:45+00:00 2026-06-05T14:50:45+00:00

I have files like .doc .pdf .excel… and i want to open them externally.

  • 0

I have files like .doc .pdf .excel… and i want to open them externally.

I tried intent.ACTION_VIEW but it open it in the browser.

How can I open them with which ever application the user has as a default handler?

File file = new File(Globals.SAVE_PATH + filename);
openFile(file.toURI());


public void openFile(URI uri) {
        Intent i = new Intent(?????);
        i.setData(Uri.parse(uri.toString()));
        startActivity(i);
    }
  • 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-05T14:50:46+00:00Added an answer on June 5, 2026 at 2:50 pm

    Thanks for your answers but I found this method to be the easiest.

    String path="File Path";
    
    Intent intent = new Intent();
    intent.setAction(android.content.Intent.ACTION_VIEW);
    File file = new File(path);
    
    MimeTypeMap mime = MimeTypeMap.getSingleton();
    String ext=file.getName().substring(file.getName().lastIndexOf(".")+1);
    String type = mime.getMimeTypeFromExtension(ext);
    
    intent.setDataAndType(Uri.fromFile(file),type);
    
    startActivity(intent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application, I have a provision for users to upload files like doc,
I have added the sdk files like dropbox website says, but I can't figure
I have a bunch of files in a directory, mostly labled something like... PO1000000100.doc
I have some files without extension. I would like associate extensions to them. For
I have some files in my folder /home/sample/* * /*.pdf and *.doc and *
I am making an iPad app where you can download files (like PDF, doc,
So I have files.... .doc .docx .xls .xlsx and .pdf that are on the
I would like to have a preview of a .pdf, .docx or .doc file
i have a codeigniter website structured like so: website.org/files/stuff/1/example.pdf website.org/www/index.php So all files (many
I have a file like this. rm a.txt mkdir foo cp a.doc docs I

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.