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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:56:50+00:00 2026-06-04T01:56:50+00:00

I want to write a read-only document reader. The document is an online-document. The

  • 0

I want to write a read-only document reader.
The document is an online-document.
The file format contains *.doc, *.docx, *.ppt, *.pptx, *.xls, *.xlsx, *.pdf, *.txt.
Now I do it by download document to phone.
And use below code to open it.
But this method open file can be modify, I want to open with read-only.

File file = new File(TempFilePath);
String mimetype = mime_type(TempFileName);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), mimetype);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

public String mime_type(String name) {
String type = null;
String[] mime = {".htm\ttext/html", ".html\ttext/html", ".doc\tapplication/msword", ".ppt\tapplication/vnd.ms-powerpoint", ".xls\tapplication/vnd.ms-excel", ".txt\ttext/plain", ".pdf\tapplication/pdf", ".xlsx\tapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ".pptx\tapplication/vnd.openxmlformats-officedocument.presentationml.presentation", ".docx\tapplication/vnd.openxmlformats-officedocument.wordprocessingml.document"};

int i;
for(i = 0; i < mime.length; i++) {
if(name.toLowerCase().endsWith(mime[i].split("\t")[0])) {
return mime[i].split("\t")[1];
}
}
return type;
}

Because the document’s URL and phone’s wifi may in the same local network, so the GoogleDocs is not useful for me.
How can I do to read online document with read-only?

  • 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-04T01:56:52+00:00Added an answer on June 4, 2026 at 1:56 am

    I think about that you should define permission in AndroidManifest.xml of Android.
    use below permission:
    android.permission.WRITE_EXTERNAL_STORAGE
    android.permission.READ_PHONE_STATE

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

Sidebar

Related Questions

What I want to do is overwrite a read-only file. With a read/write file.
I want to write a file where an external application can read it, but
i want simultaneously read and write data into file. Can i use StreamReader and
I want to read a file (hello.in) and to write it to another file
I want to write scripts which access my internet banking data. Mostly read-only stuff
I want to: open a file in read-write mode if it exists; create it
I have a specific object with image data. And I want read/write images (in
I have a asp.net webservice running in windows server 2003, i want it read/write
I want to write a function that read line by line from a socket
I want to interrupt some specific grails domain class events(read,write,delete,update).Is there any hibernate eventlistner

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.