Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Posts: 39
Registered: ‎02-18-2013
My Device: Developer
My Carrier: Don't Know
Accepted Solution

Unable to show downloaded file



I ported one android application. Which has functionality to download a file and store and then show it in device.


I am Unable to shoe the file.


The file is getting downloaded successfully. at location Z:\misc\android\attachments


When I debug the code I am getting path of downloaded file as /SDCARD/attachments/


I am using follwoing code to download file at path


String PATH = Environment.getExternalStorageDirectory()+ "/attachments/";


To show downloaded file I am using following code

Intent intent = new Intent();
			Uri uri = Uri.fromFile(downloadedFile);
			//String mimeType = getMimeType(downloadedFile.getAbsolutePath());
				try {
					intent.setDataAndType(uri, "application/pdf");
				} catch (Exception e) {
					// TODO Auto-generated catch block


Please guide me on this.


Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: Unable to show downloaded file

Hey asharma,


Could you elaborate on what you mean when you say you're unable to show the file?


Is there an exception, is the file not in the directory, is the Uri malformed, etc.?



Justin Jasmann | Android Application Development Consultant
Developer Relations
Posts: 39
Registered: ‎02-18-2013
My Device: Developer
My Carrier: Don't Know

Re: Unable to show downloaded file



Unable to show PDF file means the PDF which I downloaded is not opening. I want that whenever i click on pdf link in my application it will start the PDF reader software and will open the downloaded PDF into that.


But this is not working on DEV Aplha device. but just now I teste dit on Z10 device it is opening.



Posts: 140
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: Unable to show downloaded file

I would upgrade the software on your dev alpha, perhaps it's quite old?