Welcome!

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

Web and WebWorks Development

Reply
Contributor
bbtests
Posts: 23
Registered: ‎02-20-2011
My Device: Not Specified

Open image file

I am trying to open an image. I do the following:

 

try {
        if (blackberry.io.file.exists(path)) {
            alert(blackberry.io.file.exists(path));
            blackberry.io.file.open(path);
            alert(" open end");
        }
    }catch(e) {
        alert(e);
    }

 

 

And I don't get any error, alerts are shown correctly but not the image. What's the problem?

Please use plain text.
New Contributor
tszepesi
Posts: 4
Registered: ‎09-12-2011
My Device: Torch
My Carrier: Rogers

Re: Open image file

Please use plain text.
Contributor
bbtests
Posts: 23
Registered: ‎02-20-2011
My Device: Not Specified

Re: Open image file

Thanks for your answer, actually I saw that before. But the thing is i don't want to create an image element, I want to open the image with the blackberry native viewer.

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Open image file

Which operating system are you using.. BlackBerry Smartphone or PlayBook?

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Contributor
bbtests
Posts: 23
Registered: ‎02-20-2011
My Device: Not Specified

Re: Open image file

[ Edited ]

Smartphone. Now, I am doing it invoking the browser (blackberry.invoke), do you know a better way to do it?

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Open image file

It will likely depend on the type of image, its extension and whether or not there is a default application assigned as its viewer.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: Open image file

It helps you.

FilePicker take the SDCard:

 

then........... you have to use 

filePicker=FilePicker.getInstance();
filePicker.setPath(imageURL);		
filePicker.setListener(new Listener() 
{		
	public void selectionDone(String url) 
	{
//      System.out.println("======================URL: "+url);
//	try 
//	{		
//		FileConnection file = (FileConnection)Connector.open(url);
//		Do what ever you want.
//		file.close();
//	} 
//	catch (IOException e) 
//	{
//		e.printStackTrace();
//	}  
}
});
filePicker.show();	

 After this if you want to do somthing to this image(croping or store to another file) the the commented place will help you.

 

Right now the commented lines won't need to you.

=====================================================================================

Feel free to click LIKE button which is at right side of THUMB symbol.

 

 

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.