Development Example – Document Viewer Applet

The document viewer can be used by third party applications. These applications can launch the document viewer application directly, and pass in a document or image to view. In order to launch a document the application passes the location of the file they wish to open. This document must be saved locally on the device

Applications broadcast Intent.ACTION_VIEW with the file’s URI and Mime type.

 File document = 
      new File(Environment.getExternalStorageDirectory(), "document.pdf"); 
 String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension( 

 if (mimeType != null) { 
      Intent intent = new Intent(Intent.ACTION_VIEW); 
      intent.setDataAndType(Uri.fromFile(document), mimeType); 


View Full Source Code