Skip to main content

Downloading files via HTTP to Android flash disk instead of relying on the browser, for better user experience

 

Scenario:

When the user hits a list item within the Android ListView control we would like to open a document in this case its a .pdf document from one of our web sites. The website expects a parameter and serves a pdf, matching the parameter in the request. When a file is not available we get a standard 404.

There are times when you just cannot rely on the browser available on Android handsets to open documents for various reasons, one being you want to pop specific error messages on the screen ie document ‘NAME’ is not available yet and some reasons. Our users did not like the passing the control to the browser from the Android application and then reopen the application to get back to where you were.

 

Solution Discussion

One of the possible solution is to stream the file and write it to and disk and create an activity to open the file on a pdf reader application. PDF readers are shipped with Android which made our lives a lot easier. The small minority who did not have the pdf reader will have problem viewing the file. I am keen to find out how others are handling similar requirements.

 

Here is the item click handler

image

 

This is the function to download and save the pdf file into the disk.

This function itself is simple enough, load a file name and file path and forms a URI.

- Delete any existing file before creating the new file

image

Comments

Popular posts from this blog

External Authentication providers for SharePoint 2010–(Oracle/Sun Directory as user stores)

External Authentication providers for SharePoint 2010: Thank you for continuing to read my blogs. It is a Sunday afternoon and the Roosters are leading Panthers 10 points to 6 in NRL, by the look of it, it has all the signs of turning into a one sided match in the second half. I thought I might write a blog about SharePoint and Single Sign On with Non-Microsoft Technologies. The Problem: Often Organisations would like to utilise their existing stack of technologies with SharePoint. This is due to the popularity of SharePoint as a platform to consolidate and provide a range of application services either to replace an existing set of tools or compliment an existing applications suite. We fall under the latter. I am working within a truly heterogeneous environment at the moment, the extranet applications are built on a mix of technologies such as OpenText Livelink for DMS, Java and JBPM for for workflow and front end portals, Sun Directory and Oracle for User data and other DB La...

Combine agile and rapid prototyping to deliver a successful Microsoft Dynamics CRM project very quickly

  The Situation: If you are in the Software Development space you would have been at some stage, part of a long and winding CRM project. Also the reasons for the lengthy CRM projects range from requirements changing through the course of the project, lack of strong vendor selection process to strong leadership to make critical decisions. There is no silver bullet that can get you through the project without any of the above simply because projects are established and executed by people. How do we tackle a CRM project without much fuss.?   The Solution discussion: Microsoft Dynamics CRM provides the basic building blocks and the tools to extend it to meet your custom requirements. It is also easier to deliver a successful Dynamics CRM project faster by Combining Agile and rapid prototyping. This is exactly the approach being demonstrated here. This approach may not work if you don’t have enough experience within delivery team to estimate work effort accurately and execu...

Hiring for success

                              Hiring for success It goes without saying that you hire great people and they build a company for you. Here are three points to consider when you are hiring, particularly if you are hiring to build your first product. 1. Don't hire someone if you would not work for them This has nothing to do with how smart the person is; it is all about the attitude and personality. This is the philosophy Facebook adopted in their early days and Zuckerberg publicly admitted that he did not hire people if he thought he could not work for them. If you hire B grade players they would end up hiring C grade players and the quality continues to drop. Pay attention to equal employment opportunity laws and make sure you clearly state your requirements in the position description. You will be asked for feedback from candidates with qualifications and experience meeting the selection criteria but...